Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the (ERR! code ENOLOCAL npm ERR!) Could not install because of an error?

I am going to update npm latest version, but it's showing this error message:

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\_logs\2018-01-08T03_34_29_774Z-debug.log G:\> 

Error

like image 512
Hemanth Kumar Avatar asked Jan 08 '18 03:01

Hemanth Kumar


People also ask

What is npm err?

Learn how to solve npm error code 1 when running npm install. Photo from Unsplash. The npm ERR! code 1 error usually occurs when you run the npm install command. This cause of this error is that one of the dependencies you define in your package.


2 Answers

This is an issue in node which is caused by white space in your windows username (possibly between the first-name and last-name in windows).

run the following command after replacing firstname with your windows user firstname in command prompt with administrator access

npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global 
like image 81
makeshnaidu2011 Avatar answered Sep 17 '22 15:09

makeshnaidu2011


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

screenshot of terminal output

like image 26
Hemanth Kumar Avatar answered Sep 17 '22 15:09

Hemanth Kumar