0

I previously had an issue with my node.js app on Heroku. I added the dependency into my package.json and now it is working. But, is this the best way to do it?

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "3.4.4",
    "jade": "*",
    "stylus": "*",
    "ejs": "0.8.5"
  },
  "engines": {
    "node": "0.10.1",
    "npm": "1.3.14"
  }
}

I ask because the other dependencies have a "*" which were there by default in my express app. What exactly does that mean and am I fine with leaving this file the way it is?

1 Answer 1

1

The * means that any version is fine. When running npm install (what Heroku does when pushing your solution) npm is going to get the latest version of the appropriate module.

This is usually not what you want because a new module version may break your existing code base. It's way better if you put fixed version numbers into your package.json file.

This still does not necessarily solve all potential issues (because you can not control what the module you require require for themselves), but it helps a lot. To really solve this issue you need to think about how to package your application including the modules you depend on. If you Google for this, you should find lots of results on how to do this.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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