Andrew
Andrew

Reputation: 5715

Side affects installing node modules and changing Node.js version?

Are there any issues or side affects to installing node modules under a particular Node.js version, changing the version of Node.js (eg. with NVM or a general node upgrade), and using the previously installed node modules?

Upvotes: 2

Views: 2382

Answers (1)

user3536179
user3536179

Reputation:

Yes there are! If I install a module tested against a certain version of node and thereafter I update my node version, I can’t guarantee that the module will still work as expected.

There is an optional field engines that can be set in the package.json; from here, the module publisher can specify the version of node needed for his module to work, e.g.

{ "engines" : { "node" : ">=4 <6" } }

This will send a warning message during the package installation if your node version is not supported.

Upvotes: 3

Related Questions