简体   繁体   English

npm 错误! 安装 next.js 时

[英]npm ERR! while installing next.js

I have a problem like while I am trying to install next.js using npm install --save next then showing below error like我有一个问题,比如当我尝试使用npm install --save next会显示如下错误

npm ERR. npm 错误。 Unexpected end of JSON input while parsing near '..::{"eslint"."3.19,0","' JSON 输入在 '..::{"eslint"."3.19,0","' 附近解析时意外结束

I just stack into that for past several hours.我只是在过去的几个小时里堆积起来。 How can I resolve that?我该如何解决?

package.json

{
  "name": "a-client-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "node server.js -p $PORT",
    "build": "next build",
    "start": "NODE_ENV=production node server.js -p $PORT"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "express": "^4.17.1",
    "react": "^16.9.0",
    "react-dom": "^16.9.0"
  }
}

Info:信息:

OS: Windows 10
NodeJS: 10.16.3
NPM: 6.11.3

Thanks谢谢

The issue was due to the node cache.问题是由于节点缓存造成的。

npm cache clean --force

fixed the issue.解决了这个问题。

Writing answer here in case anyone else runs across this.在这里写下答案,以防其他人遇到这个问题。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM