简体   繁体   中英

npm ERR! code ENOLOCAL

after making a software to my laptop I installed all the programs includes node js my OS windows

$ node -v
v8.11.1

and the npm

$ npm -v
v5.6.0

when I tried to install npm globally it's gave me this error :

$ 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 -g install 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.

Step 2: run npx create-react-app your-app-name

I got the same issue. What I did was to rename the package-lock.json by:

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

  1. sudo npm config rm proxy
  2. sudo npm config rm https-proxy
  3. sudo npm install npm@latest -g

These steps works for me. Hope they could be helpful to you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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