When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0)

后端 未结 27 1412
闹比i
闹比i 2020-11-28 02:29

I am getting this error while running sudo npm install. On my server, npm was installed earlier. I\'ve tried to delete the package-lock.json file,

相关标签:
27条回答
  • 2020-11-28 02:44

    all solutions failed for me till i checked router settings; it was set to only IPV4.. i changed and put ipv4v6 and all is working fine now.

    0 讨论(0)
  • 2020-11-28 02:45

    Updating .npmrc and the registry to https:// worked for me

    registry=https://registry.npmjs.org/
    
    0 讨论(0)
  • 2020-11-28 02:45

    You should check Connection-specific DNS Suffix when type “ipconfig” or “ifconfig” in terminal

    0 讨论(0)
  • 2020-11-28 02:45

    Before i was running this command

    npm install typescript -g
    

    after changing the command it worked perfectly.

    npm install -g typescript
    
    0 讨论(0)
  • 2020-11-28 02:47

    Delete package-lock.json file and then try to install

    0 讨论(0)
  • 2020-11-28 02:48

    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 by the first two checksums in package-lock.json:

    sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==
    

    and put the third checksum into its "integrity" field:

    sha512-WXI95kpJrxw4Nnx8vVI90PuUhrQjnNgghBl5tn54rUNKZYbxv+4ACxUzPVpJEtWxKmeDwnQrzjc0C2bYmRJVKg==
    

    A more detailed description is here.

    0 讨论(0)
提交回复
热议问题