Swacblooms🦋

Making the Moves
Menu
  • Home
  • Motivation
  • Education
  • Programming
  • About
  • Contact
  • Privacy Policy
Home
Uncategorized
Sharing node_modules on windows
Uncategorized

Sharing node_modules on windows

Samson Amaugo November 6, 2019

Hi folks, we are back and banging, I once talked about how to use same node modules for your various react app project. but that article was tailored for Linux operating system or distros. So in this article, I’ve baked the various steps necessary for you to apply the same technique on windows.

Step 1

Have an existing react app project with existing packages. This would enable you to leverage the node_module folder for sharing with future react apps if needed.

Step 2

clone a react repo from GitHub or you can download an existing react project file from code sandbox.

Step 3

Open the downloaded react app in any code editor of your choice. I personally use Visual studio code.

As you can see there is no existing node module to run the react app. Since I already have an available node module from my previous react app I can use windows symbolic tool to create a symbolic link that would reference my other node_module. To know more about symbolic links you can check this.

Step 4

Open the command prompt environment in administrator mode and make sure your terminal is pointing at the current directory.

So we would look at how to set up the symbolic link using a windows tool called mklink.

Mklink is written in this pattern:

mklink /D 'name of the link' 'the location of the file you want to target'

Remember to make it easier, you need to open the terminal in the current directory that you want to add the symbolic link too. The “/D” above means that the target is a file. They are other kinds ok links too.

Step 5

So I would name the link “node_modules” and set the location of the actual node_module that I want to link to.

But since when using visual studio code the default terminal option is Powershell. We would need to append the above mklink syntax with a little command so that the power shell can run the command prompt tool (‘mklink’).

The new syntax to run would look like this:

cmd /c mklink /D 'name of the link' 'the location of the file you want to target'

For it to work you also need to make sure that you open your visual studio as an administrator.

After running the command, a “node_modules” symbolic link would be created which would allow you to run the “npm run start” command.

Thanks, guys please if you have any contribution lay it down below

Prev Article
Next Article

Related Articles

Hello guys this tutorial covers how to create a pwa …

How to make a PWA and host in Azure-1

OK so in the previous post we learnt how to …

How to make a PWA and host in Azure-2

About The Author

Samson Amaugo

I am Samson Amaugo. I am a full-stack developer and I specialize in DotNet and the MERN stack.

4 Comments

  1. Ralph

    Wow! This helped a lot. Thanks a lot, Sam.

    November 11, 2019
    • Sammy

      you’re welcome man

      November 16, 2019
  2. mishimi

    Hey thanks for this! Quick question, can it be a relative path instead of an absolute path? I have multiple projects within the same solution and although the absolute path method works, when it comes to sharing work on git, it would be better for us to have a relative path. Thanks.

    March 31, 2021
    • Sammy

      Yes you can make use of a relative path rather than an absolute path.

      August 3, 2021

Leave a Reply

Cancel reply

Search Site

Recent Posts

  • Running Entity Framework Migrations in an Aspire-Bootstrapped Orleans Project
  • Using XDebug in Laravel Sail (VSCODE)
  • Custom Redis Streams Provider for Orleans
  • Creating a Custom File Storage Provider for Microsoft Orleans
  • Incremental Generators In C#

Categories

  • EDUCATION
  • Motivation
  • Programming
  • Uncategorized

Get more stuff

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

we respect your privacy and take protecting it seriously

RSS Swacblooms

  • Running Entity Framework Migrations in an Aspire-Bootstrapped Orleans Project
  • Using XDebug in Laravel Sail (VSCODE)
  • Custom Redis Streams Provider for Orleans
  • Creating a Custom File Storage Provider for Microsoft Orleans
  • Incremental Generators In C#
  • Hot Chocolate Data Loader: A Quick Guide
  • Exploring Policy-Based Authorization in Minimal API with .NET 8
  • Using Cloud Firestore in Blazor WebAssembly
  • Serving A VueJs App from DotNet
  • Dynamic Subscriptions in Hot Chocolate 🔥🍫

Swacblooms🦋

Making the Moves
Copyright © 2025 Swacblooms🦋
Swacblooms - Making the Moves