npm ERR! Unexpected token < in JSON at position 12842

前端 未结 11 1702
借酒劲吻你
借酒劲吻你 2021-01-01 10:59

Every time I try installing any package or even if I try doing npm install I keep getting this error. I have no idea why I am getting the error. I am totally ne

相关标签:
11条回答
  • 2021-01-01 11:38

    For this type of error try with below steps:

    • Delete package-lock.json

    • Run npm install

    The above solution worked correctly for me. Hope will work for you.

    0 讨论(0)
  • 2021-01-01 11:39

    try to remove package.lock file

    Possible issue here

    0 讨论(0)
  • 2021-01-01 11:40

    For me, deleting package.lock was not enough. My IDE always said this error:

    Unexpected token <

    So what I did:

    1. Removed package.lock file
    2. In IDE: npm cache verify
    3. I write in the plain command-line interpreter , NOT in IDE :

      npm install @angular/http
      
    0 讨论(0)
  • 2021-01-01 11:43

    It's because of package-lock.json. I just run the rm package-lock.json and It works for me.

    0 讨论(0)
  • 2021-01-01 11:44

    For me , removing package.lock did not work

    Try the following steps

    1- set registry to https://registry.npmjs.org/. http did not work and had to change it to https

    npm config set registry https://registry.npmjs.org/
    

    2- I am behind a corporate firewall so i had to setup my proxy and https-proxy accordingly in the format - http://yourproxyurl:port

    npm config set proxy http://someproxyurl.com:8080
    npm config set https-proxy http://someproxyurl.com:8080
    

    3 - Set ssl to false

    npm config set strict-ssl false
    

    These steps worked for me. Hope this helps.

    0 讨论(0)
  • 2021-01-01 11:45

    I just delete the package-lock.json and run npm i again, it works for me

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