3

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": "[email protected]", <--- 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.

1
  • In your package.json if you specify the exact version that you want to install, do you still need shrinkwrap? Commented May 4, 2014 at 19:42

3 Answers 3

1
+50

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 [email protected]

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 [email protected], and npm 1.1.21 is probably not compatible with [email protected].

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 [email protected] version and try to install [email protected] 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

Sign up to request clarification or add additional context in comments.

3 Comments

i get "Error: version not found: [email protected]"
see my edit, even if i do not understand why appfog would force you to use such an old npm-version. according to this docs.appfog.com/languages/node#node-dep-mgmt it should just work...
I kinda went with solution 2 and just wrote a small script that removes "from" lines from the file, which feels a bit hackish. I should probably just switch to a proper hosting.
1

Try this:

npm install https://github.com/npm/npm/archive/v1.1.21.tar.gz
node ./node_modules/npm/bin/npm-cli.js shrinkwrap

2 Comments

i get "Error: npm doesn't work with node v0.10.26" , does it mean that i have to install another version of node aswell?
Yes, to use that npm version, you will have to install another version of node somewhere. You could install it in a different directory and refer to that node specifically when doing this to keep your default node. n suggested by @hereandnow78 seems to be an easy way to do that.
1

Another—possibly simpler—solution is to just include node_modules into your repo.

Related: Should I check in node_modules to git when creating a node.js app on Heroku?

1 Comment

I tried this, Appfogs ruby gems throws an error "No such file or directory" when i try to run "af update <name>"

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.