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
?
Santiago Gelvez
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!