2013-04-08 23:44
采纳率: 100%
浏览 221


I used nvm to download node v0.4.10 and installed npm to work with that version of node.

I am trying to install express using

npm install express -g

and I get an error that express requires node version >= 0.5.0.

Well, this is odd, since I am following the directions for a node+express+mongodb tutorial here that used node v0.4.10, so I am assuming express is/was available to node v0.4.10. If my assumption is correct, how do I tell npm to fetch a version that would work with my setup?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • 撒拉嘿哟木头 2013-04-09 02:01

    If you have to install an older version of a package, just specify it

    npm install <package>@<version>

    For example: npm install express@3.0.0

    You can also add the --save flag to that command to add it to your package.json dependencies, or --save --save-exact flags if you want that exact version specified in your package.json dependencies.

    The install command is documented here:

    If you're not sure what versions of a package are available, you can use:

    npm view <package> versions

    And npm view can be used for viewing other things about a package too.

    点赞 打赏 评论
  • In my opinion that is easiest and fastest way:

    $ npm -v


    $ npm install -g npm@latest-3


    $ npm -v


    点赞 打赏 评论
  • YaoRaoLov 2017-07-03 07:47

    It's quite easy. Just write this, for example:

    npm install -g npm@4.6.1


    npm install -g npm@latest    // For the last stable version
    npm install -g npm@next      // For the most recent release
    点赞 打赏 评论
  • 狐狸.fox 2018-07-22 06:47

    On Ubuntu you can try this command.

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable 

    Specific version : sudo n 8.11.3 instead of sudo n stable

    点赞 打赏 评论
  • Lotus@ 2018-07-25 05:32

    npm install -g npm@version

    in which you want to downgrade

    npm install -g npm@3.10.10

    点赞 打赏 评论
  • 七度&光 2018-08-16 12:23

    you can update your npm package by using this command:

    npm install <package_name>@<version_number>

    example: npm install yargs@12.02

    点赞 打赏 评论
  • elliott.david 2018-09-05 19:25

    You can use the following command to install a previous version of an npm package:

    npm install packagename@version
    点赞 打赏 评论

相关推荐 更多相似问题