简体   繁体   中英

How can I use npm 2.0 on IBM Bluemix?

Is it possible to use npm version 2 on Bluemix? By default it runs version 1.4, but I want to "install" a package from a local directory.

I was able to configure the npm version when using the community open source Node.js buildpack and setting the npm version in my package.json . See below.

"engines": {
  "npm": "^2.1.0"
}

cf push mynodeapp -b https://github.com/cloudfoundry/nodejs-buildpack

Not sure if this is possible using the default Node.js buildpack yet.

In the staging output, you should see: Npm engine: ^2.1.0

Probably you have to modify package.json like below:

"engines": {
  "npm": "^2.1.0"
}

After that you can push your app to bluemix and verify the same in staging output. Hope it helps!!

You could package the dependency inside your application directory, and create a "preinstall" script that will run an npm install on that dependency:

  "scripts": {
    "start": "node server.js",
    "preinstall": "npm install relative/path/to/module"
  },

This should work locally and on Bluemix. Note that "postinstall" is also an option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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