英文:
create-react-app not working even when I update node
问题
我尝试运行create-react-app,但一直收到关于更新我的node版本的错误:
引擎 "node" 与此模块不兼容。预期版本 "^8.10.0 || ^10.13.0 || >=11.10.1"。得到 "11.10.0"
我找到了这个帖子,并尝试使用 sudo n stable
。输出如下:
已安装 : v12.14.0 到 /usr/local/bin/node
激活 : v11.10.0 在 /Users/Kristin/.nvm/versions/node/v11.10.0/bin/node
我在这里备注一下,我安装的版本是12.14.0,但正在使用的是11.10.0。这可能是问题吗?
之后,我执行了以下操作:
npm install create-react-app -g
create-react-app myappname
由于以下错误,我无法安装create-react-app:
npm WARN saveError ENOENT: 找不到文件或目录,打开 '/Users/Kristin/flatiron/package.json'
npm WARN enoent ENOENT: 找不到文件或目录,打开 '/Users/Kristin/flatiron/package.json'
npm WARN flatiron 没有描述
npm WARN flatiron 没有存储库字段。
npm WARN flatiron 没有 README 数据
npm WARN flatiron 没有许可字段。
我是否仍在运行不正确的node版本,或者还有其他问题?
提前感谢您的时间和建议!
英文:
I am trying to run create-react-app and keep getting an error about updating my node version:
The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "11.10.0"
I found this post and tried using sudo n stable
. The output was:
installed : v12.14.0 to /usr/local/bin/node
active : v11.10.0 at /Users/Kristin/.nvm/versions/node/v11.10.0/bin/node
I am noting here that the version I have installed is 12.14.0 but 11.1.0 is the one being used. Could that be the issue?
After that, I did the following:
npm install create-react-app -g
create-react-app myappname
I was unable to install create-react-app due to this error:
npm WARN saveError ENOENT: no such file or directory, open '/Users/Kristin/flatiron/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/Kristin/flatiron/package.json'
npm WARN flatiron No description
npm WARN flatiron No repository field.
npm WARN flatiron No README data
npm WARN flatiron No license field.
Is it possible that I am still running the incorrect version of node or is there something else going on here?
Thank you in advance for your time and advice!
答案1
得分: 1
尝试
npx -p node@<输入所需的版本号> -- npx create-react-app my-app --template typescript
在此处找到:https://github.com/facebook/create-react-app/issues/9614
英文:
try
npx -p node@<input_desired_version_here> -- npx create-react-app my-app --template typescript
found here https://github.com/facebook/create-react-app/issues/9614
答案2
得分: 0
尝试全局安装 create-react-app,使用以下命令:
npm install -g create-react-app
英文:
try to install create-react-app globally with:
npm install -g create-react-app
答案3
得分: 0
尝试使用 npm uninstall -g create-react-app
删除已有的内容,然后全局安装 npm install -g create-react-app
。
你可以在 https://create-react-app.dev/docs/getting-started/ 阅读文档。
英文:
Try deleting what you already have with npm uninstall -g create-react-app, then globally install npm install -g create-react-app.
You can read the documentation at https://create-react-app.dev/docs/getting-started/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论