Hemanth Kumar
Hemanth Kumar

Reputation: 819

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

Upvotes: 31

Views: 83753

Answers (12)

Akash Bhaumik
Akash Bhaumik

Reputation: 9

Run npm ci. Its works for me.

Upvotes: -1

In the latest Windows, the firewall will block the node.exe to create package.json.

So turn off the firewall settings and try once. It worked for me.

Upvotes: 0

Akhil Krishnan
Akhil Krishnan

Reputation: 81

If you are facing with this issue, first you should update npm using the below code:

npm -g install npm

then try to create the React file. It is working 100% for me.

Upvotes: 8

makeshnaidu2011
makeshnaidu2011

Reputation: 691

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

Upvotes: 69

Nanda
Nanda

Reputation: 31

I got error npm ERR! code ENOLOCAL while running npx create-react-app my-app uninstall and install is worked for me… npm uninstall -g create-react-app

npm install -g create-react-app this will upgrade your npx, then run npx create-react-app my-app this works fine

Upvotes: 3

yahya jamaldine
yahya jamaldine

Reputation: 1

I got the same problem while trying to use sevelte with the command

npx degit sveltejs/template youproject

The following was useful:

install -g degit

Upvotes: 0

Anchal Ajay
Anchal Ajay

Reputation: 95

npm cache verify
npm install -g create-react-app

Upvotes: 3

Hemanth Kumar
Hemanth Kumar

Reputation: 819

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

Upvotes: 36

Rahul Kewat
Rahul Kewat

Reputation: 65

Please verify, whether your npm has installed create-react-app in **%AppData%Roaming\npm\node_modules**

if not then install it by using the command

npm install -g create-react-app

Upvotes: 1

Anil  Gupta
Anil Gupta

Reputation: 145

Run CMD in administrator mode and fire below commands in order

  1. Run cmd as administrator
  2. Run npm config edit (You will get notepad editor)
  3. Change prefix variable to C:\Users\AppData\Roaming\npm
  4. npm install -g create-react-app Go to the link for more npm - EPERM: operation not permitted on Windows Thanks.

Upvotes: 3

caballero700
caballero700

Reputation: 11

This worked for me:

npm install -g degit

is like an upgrade

Upvotes: 1

Davinder
Davinder

Reputation: 5146

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.

You can try to following:

  1. Move "package-lock.json" to some other folder, outside current directory.
  2. npm install

Upvotes: 13

Related Questions