【问题标题】:npm ERR! while installing next.jsnpm 错误!在安装 next.js 时
【发布时间】:2020-01-24 05:46:21
【问题描述】:

我在尝试使用npm install --save next 安装 next.js 时遇到问题,然后显示如下错误

npm 错误!在 '...:{"eslint":"3.19.0","'

附近解析时 JSON 输入意外结束

我只是在过去的几个小时里一直在坚持。 我该如何解决?

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"
  }
}

信息:

OS: Windows 10
NodeJS: 10.16.3
NPM: 6.11.3

谢谢

【问题讨论】:

  • 您能否向我们展示您的 package.json,因为我认为它的格式不正确。
  • 您可以发布您的package.json 文件的内容吗?
  • @TudorConstantin 用package.json 文件更新了帖子
  • @MichaelMano 更新了帖子
  • @MichaelMano 是的!这是诀窍。非常感谢:)

标签: node.js npm eslint next.js


【解决方案1】:

问题是由于节点缓存造成的。

npm cache clean --force

修复了问题。

在这里写答案以防其他人遇到此问题。 :)

【讨论】:

    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 2014-11-21
    • 2012-02-09
    • 2022-01-10
    • 2016-04-03
    • 1970-01-01
    • 2015-01-16
    相关资源
    最近更新 更多