【问题标题】:Webpack installation issueWebpack 安装问题
【发布时间】:2018-05-24 02:31:56
【问题描述】:

我想用 npm 设置 webpack 和 babel,但是我收到了这个错误

npm ERR! Unexpected end of JSON input while parsing near '...pdragon":"^0.7.0","to' npm ERR! A complete log of this run can be found in:
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\luchan.vladyslav\AppData\Roaming\npm-cache\_logs\2017-12-10T10_48_56_298Z-debug.log

这是我的 package.json

{
  "name": "ddd",
  "version": "1.0.0",
  "description": "components",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-env": "^1.6.1"
  }
}

一开始我尝试在一行中安装 webpack webpack-dev-server babel-core babel-loader 和 babel-preset-env。但是我得到了这个错误,过了一会儿我发现这个问题与 webpack 和 wepback-dev-server 有关

screenshot

【问题讨论】:

  • 你的 json 中没有额外的尾随逗号吗?
  • dferner,不,我没有

标签: javascript npm webpack installation


【解决方案1】:

看起来应该归咎于损坏的本地 node_modules。你可以删除本地的node_modules 文件夹,然后通过 `npm install' 重新安装吗?这应该可以解决问题。

【讨论】:

  • 我什至无法安装 nodemon globaly
【解决方案2】:

要解决这个问题,你应该清理你的缓存

npm cache clean --force

这样就可以解决问题了

【讨论】:

    猜你喜欢
    • 2020-08-08
    • 2019-10-02
    • 2020-09-17
    • 1970-01-01
    • 2021-05-31
    • 2016-12-13
    • 1970-01-01
    • 2017-07-02
    • 2012-05-07
    相关资源
    最近更新 更多