【问题标题】:EJSONPARSE error with npm when trying to install a package尝试安装软件包时,npm 出现 EJSONPARSE 错误
【发布时间】:2016-11-23 13:33:57
【问题描述】:

当我在运行 npm init 后尝试安装 npm 包时,我遇到了这个响应。

C:\Users\User\My Documents\brackets\2007webpackes6>npm install --save-dev babel-core
npm WARN package.json 2007webpackes6@1.0.0 No description
npm WARN package.json 2007webpackes6@1.0.0 No repository field.
npm WARN package.json 2007webpackes6@1.0.0 No README data
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "babel-core"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! file C:\Users\User\AppData\Roaming\npm-cache\babel-runtime\6.9.2\package\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\User\AppData\Roaming\npm-cache\babel-runtime\6.9.2\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\User\My Documents\brackets\2007webpackes6\npm-debug.log

错误报告告诉“package.json”中没有数据,但当我打开文件时它就在那里。

包.json:

{
  "name": "2007webpackes6",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

任何帮助将不胜感激。

【问题讨论】:

    标签: json npm npm-install


    【解决方案1】:

    我今天也遇到了同样的问题。我使用了 git bash。当我使用 windows cmd 尝试它时,它工作得很好。 现在这并没有告诉你为什么会发生错误,但也许它会让它工作。

    【讨论】:

      【解决方案2】:

      我在尝试安装 Cordova 时遇到了同样的错误,请尝试“npm cache clean”..

      【讨论】:

        猜你喜欢
        • 2022-12-05
        • 1970-01-01
        • 2019-11-03
        • 2021-07-25
        • 1970-01-01
        • 1970-01-01
        • 2021-02-28
        • 2020-12-04
        • 1970-01-01
        相关资源
        最近更新 更多