13

I deployed a node.js app in an azure "web apps" container. I added the "node_modules" folder to .gitignore and let azure install modules from package.json.

However, most modules do not get automatically installed and i have to open the instance's command line and install them manually using "npm install".

I am using node v0.12.0 and here is my package.json:

{
 "main": "server.js",
 "scripts": {
   "start": "node server.js"
 },
 "devDependencies": {
  "body-parser": "^1.12.4",
  "cors": "^2.6.1",
  "express": "*",
  "gulp": "^3.8.11",
  "gulp-jshint": "^1.11.0",
  "gulp-nodemon": "^2.0.3",
  "moment": "^2.10.3",
  "mongoose": "^4.0.3"
},
"engines": {
  "node": "0.12.0"
}
}

How can I enable automatic installation of modules through azure web apps and not be obliged to push the "node_modules" folder with each commit?

5
  • 2
    This may be related to either devDependencies that should be renamed to dependencies or native node modules that are failing to be built (mongoose) since Azure does not support native node.js modules. Can you paste the install log of Azure? Commented May 28, 2015 at 14:45
  • @Jonathan Muller thx, I am new to azure you mean the deployement log?
    – ccot
    Commented May 28, 2015 at 14:58
  • 1
    yup, so we can see wich package broke the build Commented May 28, 2015 at 15:26
  • @JonathanMuller that's the thing it is deploying successfully, I didn't know what the issue was until I opened the instance command line.
    – ccot
    Commented May 28, 2015 at 15:29
  • 1
    it is not necessary to commit node_modules! Like @Jonathan Muller said: use dependencies instead of devDependencies
    – marcel
    Commented May 28, 2015 at 15:38

1 Answer 1

24

Azure does not install the devDependencies. If you need them on production, it is not devDependencies but dependencies

In your package.json, devDependencies should be renamed to dependencies

This kind of thing appens when you npm install --save-dev.

Production dependency (needed to run): npm install --save
Otherwise (build tools, jshint, etc.): npm install --save-dev

Not the answer you're looking for? Browse other questions tagged or ask your own question.