Skip to content

Instantly share code, notes, and snippets.

@DevEarley
Last active August 2, 2019 19:41
Show Gist options
  • Save DevEarley/8243c463f298ecbe69834636099509d4 to your computer and use it in GitHub Desktop.
Save DevEarley/8243c463f298ecbe69834636099509d4 to your computer and use it in GitHub Desktop.
Setting up a single node_modules folder for all of your angular apps.

Navigate to the folder where you would like to store node_modules. In this example I will use the %userprofile% shortcut.

I am building an Angular app. So in another temp directory I created a dummy app and copied it's package.json and its node_modules folder into my User Profile directory.

Create a cmd file that contains the following.

mklink "./node_modules" "%userprofile%/node_modules"

Now you can run that command anywhere you need those node_modules.

If you have apps with different dependencies you can always create a folder for each version.

mklink "./node_modules" "%userprofile%/angular/node_modules"

or

mklink "./node_modules" "%userprofile%/react/node_modules"
@DevEarley
Copy link
Author

This approach is really buggy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment