• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

30
Views
Installing npm modules for node package

I'm making a npm package as a test, and i want to install typescript. This makes a node_modules folder which is not needed. How do i install npm depencices without node_modules?

about 1 month ago ·

Santiago Gelvez

1 answers
Answer question

0

It is practically impossible to avoid making a node_modules folder, as it contains the source code for the module, downloaded onto your hard drive.


However, even though it's impossible to avoid downloading node_modules, you can add it to an ignore file (such as .gitignore).

If you want to avoid node_modules in both Git and npm (recommended), then you only have to create a .gitignore file, as npm will ignore everything specified in the .gitignore file.

node_modules

Simply add the above in .gitignore.

If you only want it to ignore node_modules in npm and not Git (not recommended), then create a .npmignore file, and add the following:

node_modules

In summary, even though it isn't possible to remove node_modules, you can ignore it!

about 1 month ago · Santiago Gelvez Report
Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.