How to make NPM Package auto-generate folders and files?
I've used other IDEs before and there when I install an NPM package, it automatically creates many files and folder with names like “node_modules”, “.npm”, “.config”, etc.
But when I install it in a Node.js Repl, it doesn't create any file or folder except “database”, and “package-lock.json” (I created package.json tho)
Anyone have a fix of it?
As OldWizard209 mentioned, the node_modules folder as well as the other config files are kept in the background as to not clutter the files pane. If you absolutely need direct access to these for whatever reason (i.e. if you know what you're doing), you could try switching to Nix.
When you initiate npm in the replit shell, replit automatically makes a
package.json file. But if you install a package, replit makes a
package-lock.json file. However, in the
package.json file, you can see the package name in the dependencies key. For example, I installed the express module, so my
package.json is like this:
Notice the express in the end. The
node_modules file that is created for you locally on your PC, is done by replit in the background. That is why replit is an amazing tool to use.
You don't need a
node_modules file is not required for you to use the npm packages. In fact, you don't even need to initialize
npm. If you just run the code with the
require('package) statements, replit will install the packages itself.