javascriptnode.jsnpmappfogshrinkwrap

Using specific version of npm shrinkwrap


I am deploying my node.js app to Appfog but since their install script cannot parse npm-shrinkwrap.json the whole deploy process fails.

An example dependency in shrinkwrap.json today looks like this

   "async": {
      "version": "0.2.10",
      "from": "async@0.2.10", <--- This line breaks install script at appfog
      "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz"
    },

I went through the whole shrinkwrap file and removed the "from" part from each dependency declaration and i managed to upload my application, and it works.

So my question is , how do i use an older version of npm shrinkwrap so i can get the version of shrinkwrap.json that i need?

Appfog support told me i need to use version 1.1.21 but i have not succeeded in installing it.

Please ask if some info is missing.


Solution

  • if you just want to use an older version of npm, you can install it via npm (i know that sounds strange, but its possible)

    npm install npm@1.1.21
    

    edit: so you try to install a version of npm which does not exist. just run

    npm view npm
    

    and take a look at the property version, to see which versions you could install via npm.

    you will see that 1.1.21 does not exist in the registry, which means that you should try to install it via github (see answer by @sakai).

    but then you see the next problem. you are using node@0.10.26, and npm 1.1.21 is probably not compatible with node@0.10.x.

    so i for myself see basically 2 possible solutions:

    Solution 1:

    use n (or maybe nvm for switching node-versions back and forth. you could try to install a node@0.8.x version and try to install npm@1.1.21 there, and when done with shrinkwrapping switch back to your current node version.

    Solution 2

    you could setup some kind of grunt/gulp-task (i hope you use one of them) to run grunt/gulp shrinkwrap, which generates your shrinkwrap.json (via npm shrinkwrap) and when done cleans up your shrinkwrap.json