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

Sammy 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

React-ref callback
Okay guys this is a continuation of the previous react …

React- Callback Refs

solidity
Hello guys, hope you all are doing great!!! 😎.Blockchain is …

Making a small Library in Solidity

About The Author

Sammy

I am Samson Amaugo. I am a full-stack web developer and I specialize in MERN stack development

2 Comments

  1. Ralph

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

    November 11, 2019
    • Sammy

      you’re welcome man

      November 16, 2019

Leave a Reply

Cancel reply

Search Site

Recent Posts

  • Case Statement: Ruby
  • Voucher Based Ethereum System
  • Making a CRUD API using Azure Functions
  • Making a Wikipedia chatbot with WIT.AI
  • Making a small Library in Solidity

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

  • Case Statement: Ruby
  • Voucher Based Ethereum System
  • Making a CRUD API using Azure Functions
  • Making a Wikipedia chatbot with WIT.AI
  • Making a small Library in Solidity
  • Fauna+Azure Functions
  • MLH Fellowship (Major League Hacking)
  • GraphQL Basic Overview
  • VSCODE Creating Root Level Files or Folders In VsCode
  • Reactive Variables

Swacblooms

Making the Moves
Copyright © 2021 Swacblooms
Swacblooms - Making the Moves