How can I migrate my installed npm packages between computers?

Viewed 475

I am totally new to NPM, trying to set it up on a non-internet PC based on an existing build machine's installed packages. In Nuget, there's a way to export everything I have installed which can then be copied and used as a nuget location... is there a way to do this in NPM as well, package everything up and reinstall on another machine?

Copying the entire cache folder(s) seems a blunt-force option... for some reason I have both npm and npm-cache in my local app-data folder and I am not sure of the distinction.

I had hoped there might be a way to regenerate all the package archive files from the cache somehow.

3 Answers

If you just want to move your packages from one PC to another PC that don't have an internet connection you can simply just copy paste the node_modules folder to the new PC that doesn't have the internet and if your new PC has an internet connection then just copy-paste the package.json & package-lock.json to the new folder and run npm install to install all required packages. But remember in both case you need to have NodeJS and NPM installed on the the new PC :)

You should only copy package.json from one system to another and run command npm install

Related