繁体   English   中英

如何在节点服务器上运行angularjs应用程序?

[英]How to run angularjs app on node server?

我已经做了一个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 ERR!节点v0.12.7 npm ERR!npm v2.11.3 npm ERR!文件C:\\ wamp \\ www \\ First-angular-App \\ package.json npm ERR!代码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

我该怎么做以及在节点上运行我的应用程序需要做哪些其他更改?

您在第33行的"protractor": "^2.1.0"之后缺少逗号。

如果可以代替手工编写package.json,请使用npm init ,然后使用--save从控制台安装所有软件包。 这样就可以避免错别字。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM