【发布时间】:2019-06-24 06:25:16
【问题描述】:
我正在尝试学习 MEAN 堆栈,当我键入 node start 时出现此错误
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 489 while parsing
npm ERR! JSON.parse "name": "meanauthapp",
npm ERR! JSON.parse "version": '
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
下面是我使用 npm init 和 npm install NAMES --save 生成的 package.json 文件。我有一个 app.js 文件,应该可以将端口设置为 3000,并将变量设置为我安装的所需软件包
{
"name": "meanauthapp",
"version": "1.0.0",
"description": "meanauthapp",
"main": "app.js",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"ejs": "^2.6.1",
"express": "^4.16.4",
"jsonwebtoken": "^8.4.0",
"mongojs": "^2.6.0",
"mongoose": "^5.4.8",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node app"
},
"author": "",
"license": "ISC"
}
我不确定为什么会发生错误,感谢您的任何意见!
【问题讨论】:
-
当您遇到这些问题时,请尝试使用 JSON 验证器! jsonlint.com