How to run angularjs app on node server?

12,347

You're missing a comma after "protractor": "^2.1.0" on line 33.

If you can instead of writing your package.json by hand use npm init and then install all the packages from the console using --save. That way you avoid typos.

Share:
12,347

Related videos on Youtube

Hassan
Author by

Hassan

Updated on June 04, 2022

Comments

  • Hassan
    Hassan almost 2 years

    I have make a angularjs app and run it on wamp server its running fine but now want to move it on node express but after reading about that i just made change in my package.json file which is as follow:

          {
            "name": "Example",
             "namelower": "example",
              "version": "0.0.1",
               "description": "An example AngularJS project",
               "readme": "README.md",
               "repository": {
               "type": "git",
               "url": "[email protected]: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"
                                          }
                                         }
    

    after editing package.json i ran npm install on cmd but get this

             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" "install" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! file C:\wamp\www\First-angular-App\package.json npm ERR! code 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
    

    how can i do this and what other changes i need to run my app on node express??

    • Lucian
      Lucian over 8 years
      It seems like you package.json is broken. I.e. you most likely have some syntax errors.
  • Hassan
    Hassan over 8 years
    what other changes i make to run my app on express ?
  • ErikAGriffin
    ErikAGriffin over 8 years
    @Hassan just make sure you install angular with bower and configure the .bowerrc to make your path correct. That and you may need a package called 'body-parser' to access data passed in post requests to the server.
  • Hassan
    Hassan over 8 years
    i install npm for mode server following this but still not able to run my app on nodejs server scotch.io/tutorials/…
  • ErikAGriffin
    ErikAGriffin over 8 years
    I wrote a reference guide for myself a while back, maybe it will help you: smarturl.it/MEAN