json 呃!代码 ENOLOCAL npm ERR!无法安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48143945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ERR! code ENOLOCAL npm ERR! Could not install from
提问by Hemanth Kumar
I am going to update npm latest ver but it's showing this error message, help me to solve this problem thank you ..
我将更新 npm 最新版本,但它显示此错误消息,请帮助我解决此问题,谢谢..
G:\>npm i -g npm ERR! code ENOLOCAL npm ERR! Could not install from "" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hemanth\AppData\Roaming\npm-cache\_logs18-01-08T03_34_29_774Z-debug.log
G:\>
回答by Hemanth Kumar
This worked for me:
这对我有用:
npm cache verify
Then I re-ran:
然后我重新运行:
npm install -g create-react-app
And it installed like as expected: Issue resolved
它按预期安装:问题已解决


回答by Davinder
I got same issue because I was using an updated "package-lock.json" file from another system, and there was no "node_modules" folder on system where I got the problem.
我遇到了同样的问题,因为我使用的是来自另一个系统的更新后的“package-lock.json”文件,而我遇到问题的系统上没有“node_modules”文件夹。
You can try to following:
您可以尝试以下操作:
- Move "package-lock.json" to some other folder, outside current directory.
- npm install
- 将“package-lock.json”移动到当前目录之外的其他文件夹。
- 安装
回答by caballero700
This worked for me:
这对我有用:
npm install -g degit
is like an upgrade
就像升级一样
回答by Anil Gupta
Run CMD in administrator mode and fire below commands in order
在管理员模式下运行 CMD 并按顺序执行以下命令
- Run cmd as administrator
- Run npm config edit (You will get notepad editor)
- Change prefix variable to C:\Users\AppData\Roaming\npm
- npm install -g create-react-app Go to the link for more npm - EPERM: operation not permitted on WindowsThanks.
- 以管理员身份运行cmd
- 运行 npm config edit (您将获得记事本编辑器)
- 将前缀变量更改为 C:\Users\AppData\Roaming\npm
- npm install -g create-react-app 转到链接以获取更多npm - EPERM:Windows 上不允许操作谢谢。
回答by Rahul Kewat
Please verify, whether your npmhas installed create-react-appin **%AppData%Roaming\npm\node_modules**
请验证,你的npm是否在 **%AppData%Roaming\npm\node_modules**安装了create-react-app
if not then install it by using the command
如果没有,则使用命令安装它
npm install -g create-react-app
回答by Samyak Agarkar
So, I faced this issue.
Now I realise, last time I installed create-react-app without -g attribute. npmThis installed the files in folder which i was working on.
Next time when I did npm create
所以,我遇到了这个问题。现在我意识到,上次我安装了没有 -g 属性的 create-react-app。npm这将文件安装在我正在处理的文件夹中。下次我做 npm create 的时候

