您好我正在尝试通过npm安装快递我收到以下错误消息:
npm ERR! file C:\Projects\node\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token p in JSON at position 1 while parsing near 'npm
install {
npm ERR! "name...'
npm ERR! File: C:\Projects\node\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! Tell the package author to fix their package.json file. JSON.parse
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\george\AppData\Roaming\npm-cache\_logs\2017-10-
13T01_40_22_074Z-debug.log
我通过json验证器运行了package.json并收到以下内容:
Error: Parse error on line 1:
npm install--{ "nam
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got
undefined'
这是package.json中的内容:
npm install --{
"name": "node",
"version": "1.0.0",
"description": "My first project",
main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "George Meehan",
"license": "ISC"
}
我很困惑如何解决这个问题。
答案 0 :(得分:1)
正确的package.json是:
{
"name": "node",
"version": "1.0.0",
"description": "My first project",
main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "George Meehan",
"license": "ISC"
}