简体   繁体   English

npm 错误! 代码 ENOLOCAL

[英]npm ERR! code ENOLOCAL

after making a software to my laptop I installed all the programs includes node js my OS windows在为我的笔记本电脑制作软件后,我安装了所有程序,包括 node js 我的操作系统窗口

$ node -v
v8.11.1

and the npm和 npm

$ npm -v
v5.6.0

when I tried to install npm globally it's gave me this error :当我尝试全局安装 npm 时,它给了我这个错误:

$ npm install -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\Aroma\AppData\Roaming\npm-cache\_logs\2018-04- 
07T11_10_29_184Z-debug.log

or even when I tried to install it locally to a repository it's gave me:甚至当我尝试将它本地安装到存储库时,它也给了我:

$ npm install
npm WARN saveError ENOENT: no such file or directory, open 
'C:\Users\Aroma\Desktop\app\package.json'
npm notice created a lockfile as package-lock.json. You should commit this 
file.
npm WARN enoent ENOENT: no such file or directory, open 
'C:\Users\Aroma\Desktop\app\package.json'
npm WARN app No description
npm WARN app No repository field.
npm WARN app No README data
npm WARN app No license field.

up to date in 0.11s

any help would be appreciated任何帮助将不胜感激

Try this command to change the npm version:试试这个命令来更改 npm 版本:
npm -g install npm@4.2.0 npm -g 安装 npm@4.2.0
it works for me on this issue.它在这个问题上对我有用。

I had same problem.我有同样的问题。 I solved in this way.我是这样解决的。

Step 1: Open the command prompt as an Administrator and run npm install -g create-react-app to solve the npx issue.步骤1:以管理员身份打开命令提示符并运行npm install -g create-react-app以解决 npx 问题。

Step 2: run npx create-react-app your-app-name第 2 步:运行npx create-react-app your-app-name

I got the same issue.我遇到了同样的问题。 What I did was to rename the package-lock.json by:我所做的是通过以下方式重命名 package-lock.json :

mv package-lock.json package.json

, and then this issue should be solved. ,然后这个问题应该得到解决。

If you get the next issue of showing a message: [...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx , then you could do如果您收到显示消息的下一个问题: [...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx ,那么您可以这样做

  1. sudo npm config rm proxy须藤 npm 配置 rm 代理
  2. sudo npm config rm https-proxy须藤 npm config rm https-proxy
  3. sudo npm install npm@latest -g须藤 npm 安装 npm@latest -g

These steps works for me.这些步骤对我有用。 Hope they could be helpful to you too.希望他们也能对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM