【问题标题】:Error when trying to type 'node start' MEAN stack尝试键入“节点启动”MEAN 堆栈时出错
【发布时间】: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

标签: node.js stack mean


【解决方案1】:

您缺少逗号,因此无法解析无效的 JSON。将您的脚本属性更新为:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node app"
  },

【讨论】:

  • 哦,我没看到。感谢您的帮助!
猜你喜欢
  • 1970-01-01
  • 2014-08-05
  • 2015-04-03
  • 1970-01-01
  • 1970-01-01
  • 2016-04-20
  • 1970-01-01
  • 1970-01-01
  • 2023-03-24
相关资源
最近更新 更多