I'm sitting my react environment and I get this error.
New react installation. npm --version
is running correctly but still :
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Ibrahi\AppData\Roaming\npm-cache_npx\8992" as it does not contain a package.json file.
How do I fix this?
I faced same issue, problem was due to space in my user name i.e. FirstName LastName and issue is with npx. I applied following fix and everything worked just fine
npm config set cache C:\tmp\nodejs\npm-cache --global
Source: https://github.com/zkat/npx/issues/146
Many thanks to Bhupender for providing the github link!
A summary of the best answers there, for those, like me, coming late to the party:
Find the windows short name for your user directory...
cd C:\Users dir /x
Then edit the npm cache location to use the windows short name.
e.g. "C:\Users\HP User" is also "C:\Users\HPUSER~1" so the following command resolves the problem...
npm config set cache "C:\Users\HPUSER~1\AppData\Roaming\npm-cache" --global
This has the advantage of avoiding having to install create react app locally.
Late to the party but I was also facing the same issue so what I did is
npm install -g create-react-app
to get around the npx issue.npx create-react-app my-first-app
hope so it'll help you.This happens when you have a space in your path. To fix it follow these steps:
npm config edit
; cache = 'C:\Users\FIRSTNAME LASTNAME\AppData\Roaming\npm-cache'
~1
;
at the beginning of the lineyarn
Just to make sure you've got it, the line should look like this:
cache = 'C:\Users\FIRSTNAME~1LASTNAME\AppData\Roaming\npm-cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With