【发布时间】:2015-08-05 12:15:02
【问题描述】:
我已经制作了一个 angularjs 应用程序并在 wamp 服务器上运行它,它运行良好,但现在想将它移动到 node express 上,但是在阅读完之后,我刚刚在我的 package.json 文件中进行了更改,如下所示:
{
"name": "Example",
"namelower": "example",
"version": "0.0.1",
"description": "An example AngularJS project",
"readme": "README.md",
"repository": {
"type": "git",
"url": "git@git.example.com:example.git"
},
"devDependencies": {
"grunt": "0.4.2",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-jshint": "0.8.0",
"grunt-contrib-nodeunit": "0.3.0",
"grunt-contrib-uglify": "0.2.2",
"grunt-contrib-watch": "0.5.3",
"grunt-exec": "0.4.5",
"grunt-jsdoc": "0.5.4",
"grunt-karma": "0.8.3",
"karma": "0.12.16",
"karma-jasmine": "0.1.5",
"karma-ng-html2js-preprocessor": "^0.1.2",
"karma-phantomjs-launcher": "0.1.4"
},
"scripts": {
"postinstall": "bower install",
"test": "grunt build"
},
"dependencies": {
"protractor": "^2.1.0"
"express" : "~4.7.2",
"mongoose" : "~3.6.2",
"morgan" : "~1.2.2",
"body-parser": "~1.5.2",
"method-override": "~2.1.2"
}
}
编辑 package.json 后,我在 cmd 上运行了 npm install 但得到了这个
error:C:\wamp\www\First-angular-App>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
\node_modules\npm\bin\npm-cli.js" "安装" npm 错误!节点 v0.12.7 npm 错误! npm v2.11.3 npm 错误!文件 C:\wamp\www\First-angular-App\package.json npm 错误!代码 EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token 'e' at 34:6
npm ERR! "express" : "~4.7.2",
npm ERR! ^
npm ERR! File: C:\wamp\www\First-angular-App\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! C:\wamp\www\First-angular-App\npm-debug.log
我该如何做到这一点以及在 node express 上运行我的应用程序需要进行哪些其他更改??
【问题讨论】:
-
您的
package.json好像坏了。 IE。你很可能有一些语法错误。