一切都在标题中:我正在尝试按照本教程创建一个react-app:https : //github.com/facebook/create-react-app
但是它无法立即说出以下内容:
[user@localhost workspace]$ create-react-app projectname
Creating a new React app in projectpath/projectname.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.6.0
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd projectpath/projectname has failed.
从“引擎“节点”与该模块不兼容。预期版本”中推断出我的节点不是最新的。然而:
sudo n stable
给我:已安装:v12.13.1到/ usr / local / bin / node active:v10.16.3在/ bin / node
nvm use stable
给我:现在使用节点v10.0.0(npm v6.13.4)
node -v
给我:v10.0.0
任何人都有解决这个问题的想法?预先感谢您的回答。
好的,由于以下资源,我终于找到了我想要的版本:https://alligator.io/nodejs/node-version-manager/
我不知道为什么我总是坚持使用10.0.0版本。我什至卸载并重新安装了npm和node并指定了我想要的节点的最新版本,然后它又重新安装了10.0.0版本...
上面的链接提供了以下魔术命令:
nvm install 12
它下载并设置节点的版本12为ACTIVE:
“运行每个命令时,nvm将从官方网站上下载并安装Node.js的版本。安装后,它还会将您刚安装的版本设置为活动版本。”
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句