2017-10-13 46 views
0

你好我试图通过NPM安装快递时的package.json解析错误,我收到以下错误消息:试图安装快递

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

摆脱'NPM安装--'部分... – Li357

+0

删除'NPM安装--'在'package.json'。一个有效的json开始于{ – Sridhar

+0

谢谢指导者,我正在关注的课程说它需要在那里。我拿出来,它现在工作正常。我感谢Andrew和Sndhar的帮助。 – George

回答

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" 
}