How to upgrade node.js on Windows?

后端 未结 9 862
悲哀的现实
悲哀的现实 2021-01-30 15:48

I already have Node.js v0.8.0 running on Windows. Can I just run the latest installer to upgrade it to v0.8.4? I am afraid it will break existing third party modules on my machi

相关标签:
9条回答
  • 2021-01-30 16:20

    Yes. You can upgrade your node.js version to the latest by running the installer for latest node.js version at https://nodejs.org/en/. I upgraded mine from 4.4.4 to 8.11.2 running the installer.

    0 讨论(0)
  • 2021-01-30 16:23

    Just go to nodejs site & download it. You can install it directly without any hesitation. If you have any dependency on earlier version then check change logs.

    0 讨论(0)
  • 2021-01-30 16:28

    Best way to install node on windows is by using nvm-windows, so you can quickly switch between versions if you need to. This is analogous to the best way of installing node on linux and max, ie with nvm.

    But Benjen is right (how could he not be with all his scouting experience) that you can just install a different version of node, and your version will update. Your npm dependencies may have to be reinstalled, and any extensions that aren't managed by npm may need to be recompiled, but this will be true no matter how you change your node version.

    0 讨论(0)
  • 2021-01-30 16:30

    Unless you're using a module that relies on an actual bug that was present in 0.8.0 and was fixed by 0.8.4, you're OK. There were no API changes in between those two versions (and the node team is too smart to introduce such changes in a minor release).

    0 讨论(0)
  • 2021-01-30 16:31

    I don't have experience with node on Windows, but I have just upgraded node & modules on my Mac, so this is just a general answer:

    If you install v0.8, you might break your existing node modules, if they use deprecated functions, etc. The problem is that npm only checks your version of node while modules are being installed, not at run-time.

    To be on the safe side, you need to find the global node_modules folder on your machine, back it up to somewhere, then delete and reinstall the modules. You will need to do the same thing for the node_modules folders in the apps you are using. (Assuming you have package.json files, reinstalling these should be easy.)

    In practice, I don't think any of the modules I was using were actually incompatible. Good luck.

    0 讨论(0)
  • 2021-01-30 16:35

    Yes, you just install the latest version. Generally you shouldn't have any compatibility problems if you are already using the same major version (e.g. Version 0.8.x). If you are concerned about changes, you can always check the changelog for each version (link to changelog is on node.js download page at nodejs.org). That should tell you of any big changes (i.e API changes, etc).

    0 讨论(0)
提交回复
热议问题