npm ERR! Unexpected end of JSON input while parsing near

痛定思痛。 2023-01-04 14:46 250阅读 0赞

npm安装module时报错

  1. C:\Users\80022319\Desktop\node\openfaas>npm install express -g
  2. npm ERR! Unexpected end of JSON input while parsing near '...t":"^1.1.0","mkdirp":'
  3. npm ERR! A complete log of this run can be found in:
  4. npm ERR! D:\software\dev\node\node_cache\_logs\2020-12-29T05_51_48_634Z-debug.log

解决

  1. npm cache clean --force

    1. C:\Users\80022319\Desktop\node\openfaas>npm cache clean --force
    2. npm WARN using --force I sure hope you know what you are doing.
  2. npm cache verify

    1. C:\Users\80022319\Desktop\node\openfaas>npm cache verify
    2. Cache verified and compressed (D:\software\dev\node\node_cache\_cacache):
    3. Content verified: 63 (801482 bytes)
    4. Index entries: 91
    5. Finished in 0.272s
  3. npm install

    1. C:\Users\80022319\Desktop\node\openfaas>npm install
    2. npm WARN deprecated undefined@0.1.0: this package has been deprecated
    3. npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\80022319\Desktop\node\package.json'
    4. npm notice created a lockfile as package-lock.json. You should commit this file.
    5. npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\80022319\Desktop\node\package.json'
    6. npm WARN node No description
    7. npm WARN node No repository field.
    8. npm WARN node No README data
    9. npm WARN node No license field.
    10. removed 2 packages in 11.817s
    11. found 0 vulnerabilities
  4. npm install -g express

    1. C:\Users\80022319\Desktop\node\openfaas>npm install -g express
    2. + express@4.17.1
    3. added 50 packages from 37 contributors in 136.893s

发表评论

表情:
评论列表 (有 0 条评论,250人围观)

还没有评论,来说两句吧...

相关阅读