javascript - 我无法安装我的项目包

标签 javascript reactjs next.js

我在安装 expressJs 到我的包时遇到错误。我不得不执行 npm cache clean --force 没有成功,然后我删除了我的 node_modulespackage-lock.json,我尝试使用 npm i 重新安装包我仍然遇到错误。

现在我从我的电脑 windows 10 中删除了 node.js 并下载并安装了最新的节点,然后再次尝试重新安装项目包。现在我得到的错误是这个

$ npm i
npm ERR! Unexpected end of JSON input while parsing near '...ncies":{"autoprefixer'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Chioma Onyepere\AppData\Roaming\npm-cache\_logs\2019-05-28T20_26_29_676Z-debug.log

我的应用是基于 nextJs 构建的

这是 package.json

{
  "name": "ratethis",
  "version": "1.0.2",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "next",
    "build": "next build",
    "now-build": "next build",
    "start": "next start -p %PORT%"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/infinity-web-development/ratethis"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/infinity-web-development/ratethis/issues"
  },
  "homepage": "https://github.com/infinity-web-development/ratethis#readme",
  "dependencies": {
    "@zeit/next-css": "^1.0.1",
    "antd": "^3.15.1",
    "faker": "^4.1.0",
    "next": "^8.0.3",
    "next-images": "^1.1.1",
    "next-redux-wrapper": "^3.0.0-alpha.2",
    "now": "^15.0.6",
    "prop-types": "^15.7.2",
    "react": "^16.8.5",
    "react-dom": "^16.8.5",
    "react-polls": "^1.2.0",
    "react-redux": "^7.0.1",
    "redux": "^4.0.1",
    "redux-saga": "^1.0.2",
    "shallow-equal": "^1.1.0",
    "uuid": "^3.3.2"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-plugin-import": "^1.11.0",
    "babel-plugin-inline-import": "^3.0.0",
    "eslint": "^5.16.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-node": "^7.0.1",
    "eslint-plugin-promise": "^4.0.1",
    "eslint-plugin-react": "^7.11.1",
    "eslint-plugin-standard": "^4.0.0",
    "next-antd-aza-less": "^1.0.2"
  }
}

显然错误来 self 的电脑,因为它在另一台电脑上工作正常。

最佳答案

我对 npm 了解不多,但我建议尝试让它验证已经完成的安装,并以某种方式从现有安装中重写 package.json 文件。

https://docs.npmjs.com/cli/cache.html

即使安装失败并且 package.json 没有显示任何安装痕迹,也可能有一些只有 npm 知道的工件在阻碍。

关于javascript - 我无法安装我的项目包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56350758/

相关文章:

reactjs - 未捕获的语法错误 : Unexpected token '<' while deploying create react app to firebase hosting

reactjs - 使用 React 配置 Solidity 合约的最佳方法是什么?

javascript - 计算多个项目的价格

javascript - 如何 'restart' angularjs 应用程序

php - 滚动条出现在我的网站内

javascript - d3 v4 : Using stack with histogram data?

javascript - 如何使用react js在下拉列表中显示数组值?

reactjs - SEO 缺少 Gatsby JS 元描述?

javascript - Next.js API 端点调用中返回空对象的 fetch 正文

angular - 找不到模块 : Error: Can't resolve 'net' in 'node_modules/stompjs/lib'