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. json file fails to be installed properly on your computer.
See https://github.com/npm/npm/issues/16861
This worked for me:npm cache verify
Then I re-ran:npm install -g create-react-app
And it installed as expected: Issue resolved.
Other solutions mentioned in the GitHub issue include:
npm cache clean --force
OR
Deleting npm and npm-cache folders in Users%username%\AppData\Roaming
(Windows 7 and Windows 10) and running npm install
OR
Update npm by via npm i -g npm
OR
Delete package-lock.json
OR
npm cache clean
OR
Do these steps to fix the problem:
npm outdated -g
sudo npm i -g outDatedPKG
sudo npm i -g npm
package-lock.json
file._cacache
directory in ~/.npm
:
npm cache verify
npm cache clean --force
OR
.npmrc
in ~
directory:proxy=http://localhost:8123
https-proxy=http://localhost:8123
OR
npm cache clear --force && npm install --no-shrinkwrap --update-binary
OR
npm config set package-lock false
Delete package-lock.json file and then try to install
Actually the above is related to the network connectivity in side the server. When I've good connectivity in the server, the npm install gone good and didn't throw any error
The issue was indeed in package-lock.json
, and after replacing it with a working version from another branch it worked.
What's interesting is seeing the diff:
So there really is some integrity checksum in the package-lock.json
to verify that the file you are downloading hasn't been tampered with. It's just that somehow the integrity checksum was replaced in our package-lock.json
with a SHA1 instead of a SHA-512 checksum. I have no idea how this happened.
In case you don't have a working version in another branch. Consider the message
npm ERR! code EINTEGRITY
npm ERR!
sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==
integrity checksum failed when using sha512: wanted
sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==
but got
sha512-WXI95kpJrxw4Nnx8vVI90PuUhrQjnNgghBl5tn54rUNKZYbxv+4ACxUzPVpJEtWxKmeDwnQrzjc0C2bYmRJVKg==
. (65117 bytes)
Find the package in package-lock.json
using the first checksum:
sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==
and put the third checksum into its "integrity" field:
sha512-WXI95kpJrxw4Nnx8vVI90PuUhrQjnNgghBl5tn54rUNKZYbxv+4ACxUzPVpJEtWxKmeDwnQrzjc0C2bYmRJVKg==
A more detailed description is here.
My problem was 2 things:
What i did is:
Fixed my error!
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