Mas*_*her 9 javascript nomachine-nx node.js hadoop-yarn reactjs
我收到以下错误,并将 React 应用程序添加到系统上已有的 Nx 项目中:
Require stack:
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\@nrwl\devkit\index.js
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\@nrwl\react\src\utils\lint.js
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\@nrwl\react\src\generators\application\application.js
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\nx\src\shared\workspace.js
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\nx\src\cli\init-local.js
- C:\Users\HP\OneDrive\Documents\amagi-qtc\node_modules\nx\bin\nx.js
- C:\Users\HP\AppData\Roaming\npm\node_modules\@nrwl\cli\node_modules\nx\bin\nx.js
- C:\Users\HP\AppData\Roaming\npm\node_modules\@nrwl\cli\bin\nx.js
Run Code Online (Sandbox Code Playgroud)
我确实在 nx 项目中安装了 React
yarn add -D @nrwl/react
Run Code Online (Sandbox Code Playgroud)
但是当我运行这个命令时:
nx g @nrwl/react:app my-new-app
Run Code Online (Sandbox Code Playgroud)
它给了我上面的错误。
kao*_*eya 17
发生该问题的原因可能是该项目没有最新的 NX 版本包。
确保 nx cli 安装在您的本地项目中yarn add -D @nrwl/cli
。
从您的项目运行nx migrate latest
来进行升级,它将更新您的 package.json 文件。
您可以查看对 package.json 所做的更改并运行yarn
以安装它们。
最后,您必须通过运行来运行迁移nx migrate --run-migrations
。
参考:https://nx.dev/using-nx/updating-nx#updating-nx