【问题标题】:I can't install Parcel using npm - Failed to parse package.json data我无法使用 npm 安装 Parcel - 无法解析 package.json 数据
【发布时间】:2021-04-29 14:51:36
【问题描述】:

我在项目文件夹的 cmd 中使用 (npm init) 创建了 package.json 文件 ,然后我写了 (npm i parcel --save-dev) 这就是我得到的:

C:\Users\XPRESS\Desktop\starter>npm i parcel --save-dev
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\XPRESS\Desktop\starter\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token } in JSON at position 211 while parsing nea
r '...dex.html",
npm ERR! JSON.parse
npm ERR! JSON.parse   },
npm ERR! JSON.parse   "author": "Ibra...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\XPRESS\AppData\Roaming\npm-cache\_logs\2021-01-25T18_59_41
_237Z-debug.log

还有这个 package.json

{
  "name": "starter",
  "version": "1.0.0",
  "description": "Recipe application",
  "main": "index.html",
  
    "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html",
      
  },
  "author": "",
  "license": "ISC"
}

请有任何想法..我是新手,我 4 天找不到任何解决方案

【问题讨论】:

  • 发布你的 package.json 文件。
  • 我编辑了帖子
  • 去掉"build": "parcel build index.html",的逗号。
  • @PascalLamers 这个问题应该被关闭。该错误解释了问题所在。此外,我真的怀疑在提出问题之前是否进行了调查。

标签: javascript node.js json npm


【解决方案1】:

只需在此行删除多余的尾随逗号:

"build": "parcel build index.html"

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-10-12
  • 2022-01-23
  • 2018-06-13
  • 1970-01-01
  • 2020-02-11
  • 2017-09-10
  • 2020-12-03
相关资源
最近更新 更多