node .js -启动命令使节点崩溃,但index.js运行正常
Node.js - start command crashing node, but index.js running fine
我有一个node.js包,其中index.js文件按预期工作。
但是当我调用
npm start
出现以下错误导致崩溃:
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! file /Users/martin.mcallister/Documents/leftovers/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Trailing comma in object at 24:1
npm ERR! }
npm ERR! ^
npm ERR! File: /Users/martin.mcallister/Documents/leftovers/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! /Users/martin.mcallister/Documents/leftovers/npm-debug.log
我已经检查过包裹了。json文件。没有评论。据我所见,没有错误。
{
"name": "leftovers",
"version": "1.0.0",
"description": "Use your leftovers",
"main": "index.js",
"scripts": {
"start" : "node index.js",
"test": "echo '"Error: no test specified'" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/niazipan/leftovers.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/niazipan/leftovers/issues"
},
"homepage": "https://github.com/niazipan/leftovers#readme",
"dependencies": {
"body-parser": "^1.15.2",
"express": "^4.14.0"
},
}
即使我从json中删除开始行并运行npm start
,它仍然会在顶部出现错误而崩溃。
任何想法吗?
检查你的错误老兄,它说它不能解析你的包。
{
"name": "leftovers",
"version": "1.0.0",
"description": "Use your leftovers",
"main": "index.js",
"scripts": {
"start" : "node index.js",
"test": "echo '"Error: no test specified'" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/niazipan/leftovers.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/niazipan/leftovers/issues"
},
"homepage": "https://github.com/niazipan/leftovers#readme",
"dependencies": {
"body-parser": "^1.15.2",
"express": "^4.14.0"
},
}
最后一行前的逗号构成您的包。Json文件无效
相关文章:
- 尝试创建一个具有z-index的堆叠菜单'使用HTML5/CSS3/JS
- 如何在ng repeat angular js中使用$index
- 使用Express4将数组从Nodejs中的app.js传递到routes/index.js
- stub.callsArg(index) from Sinon.JS 是做什么的
- AngularJS应用程序:如何将.js文件包含到index.html中
- nodemon找不到模块'/路径/to/project/home/index.js'
- 使用webpack时如何避免这种硬编码的index.js
- index.js没有做index.ts做的事
- Express 4将Socket.IO传递到Index.js
- 将值添加到Handlebar.js@index
- Vue.js"track-by-$index”;,如何单独呈现列表项
- Angular JS $scope 来自 Parts,在 index.html 中不起作用
- 如何将 JSON 对象从 index.js 发送到 node.js 中的 html
- 挖空.js使用 $index 和 if 绑定
- jQuery `index()` equivalent in Vanilla JS
- 角度JS:$index类似过滤器的参数
- 在 webpack -p 上的 ./app/index.js 中存在错误
- 香草 js 替换 jQuery 的 index() 和 eq()
- node.js:如何将变量直接输出到 index.html
- Knockout js $index()似乎不起作用