Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
share node.js modules across React apps?

I'm trying out node.js and npm for the first time, to code a React tutorial using the Create React App boilerplate.

The first simple app is working fine.

The file structure looks like this (Windows 7):

file structure of node.js app created with the Create React App boilerplate

My concern is that the node_modules folder is 70mb on file and occupies 120mb on the disk.

It seems that each time I create a new app via Create React App, the same folder is going to get re-created for the new app, and occupy a similar vast amount of storage.

My question is: is there some way to create new apps such that the same modules are not downloaded and don't end up occupying more and more storage, and can instead be shared across apps (not sure if node.js philosophy supports sharing of such modules).

Update: I have supplied my own answer to this question.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can install npm modules globally with the flag -g, like so:

# npm install -g jshint

That way they would be accessible to all your projects. See docs on npm install for details.

P.S. Separate advice - make sure you use somehat new (>=3.X) version of npm - otherwise you might run into problems with long file paths on Windows.

over 4 years ago · Santiago Trujillo Report

0

I'm new to the node.js and npm way of doing things. It seems that this is the normal way of doing things, and dependencies are scoped to single projects. There are many advantages to doing it this way, and I no longer want to share the modules folder across different projects.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!