Search code examples
node-modules

Node_modules cannot be created


After running these 2 commands I still cant get node_modules folder

npm init -y npm install

Why is it like that? I’m stuck here for 3 weeks. Please help

But when i download someone else project and run the same commands it creates node_modules folder.enter image description here


Solution

  • This is correct and by design.

    If you have no modules installed in your project then npm will not create a node_modules folder.

    Since you have just started a project then no matter how many times you run npm install it will not create a node_modules folder.

    Built-in node modules such as fs are not installed in the node_modules folder so if you are only using modules that comes with node and don't install any 3rd party dependencies you won't have a node_modules folder in your project.