node - npm报错 Failed to parse json

查看:1040
本文介绍了node - npm报错 Failed to parse json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

项目启动不了

npm报错信息
不知道是什么问题

F:\meadowlark>npm start
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "E:\\program files\\nodejs\\node.exe" "E:\\program     files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! file F:\meadowlark\package.json
npm ERR! code EJSONPARSE
 
npm ERR! Failed to parse json
npm ERR! Trailing comma in object at 21:3
npm ERR!   },
npm ERR!   ^
npm ERR! File: F:\meadowlark\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! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file.   JSON.parse
 
npm ERR! Please include the following file with any support request:
npm ERR!     F:\meadowlark\npm-debug.log

package.json内容

{
  "name": "meadowlark",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "bcryptjs": "^2.3.0",
    "body-parser": "~1.15.1",
    "connect-mongo": "^1.3.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.2.0",
    "express": "~4.13.4",
    "express-session": "^1.14.1",
    "hbs": "~4.0.0",
    "mongoose": "^4.6.5",
    "morgan": "~1.7.0",
    "serve-favicon": "~2.3.0",
  }
}

解决方案

package.json 文件格式有问题,你查看下内容,是不是不完全是一个合法的JSON:属性名称和属性值都用双引号括起来,还有逗号啥的

这篇关于node - npm报错 Failed to parse json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆