NPM Global As Reference of NPM Local

How to refer NPM Local to NPM Global? If you don’t want to install the packages locally because it’s wasting hardisk space you can use the packages which have globally installed.

For example, you install the sass package globally:

$ sudo npm install -g grunt-contrib-sass

You don’t want to do the same for your project, project, and another project because you think the files are the same but just the locations which make it different.

So, in case we want to install sass package from global to local we can use link directive in your project folder:

$ npm link grunt-contrib-sass

It will automatically create node_modules/grunt-contrib-sass link to grunt-contrib-sass global package. Piece of cake.

Leave a Reply