npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'

I just want to install to my project which is located on folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my project folder. How to fix this?

C:\Users\Nuwanst\Documents\NodeJS\>npm install

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'
npm WARN Nuwanst No description
npm WARN Nuwanst No repository field.
npm WARN Nuwanst No README data
npm WARN Nuwanst No license field.

59 thoughts on “npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'”

  1. Have you created a package.json file? Maybe run this command first again.

    C:\Users\Nuwanst\Documents\NodeJS\>npm init

    It creates a package.json file in your folder.

    Then run,

    C:\Users\Nuwanst\Documents\NodeJS\>npm install --save

    The --save ensures your module is saved as a dependency in your package.json file.

    Let me know if this works.

  2. You need to make sure if package.json file exist in app folder. i run into same problem differently but solution would be same

    Run this command where “package.json” file exist. even i experience similar problem then i change the folder and got resolve it. for more explanation i run c:\selfPractice> npm start whereas my package.json resides in c:\selfPractice\frontend> then i change the folder and run c:\selfPractice\frontend> npm start and it got run

  3. if your node_modules got installed in say /home/UserName/ like in my case,
    your package-lock.json file will also be there. just delete this file, go back to your app folder and run npm init and then npm install <pkgname> (e.g express) and a new node_modules folder will be created for your.

  4. we need to create package.json by entering npm init and enter package name as package.json and optionally fill other requirements else press enter and at last
    enter yes to confirm.
    Now install any npm package without any error.

    npm install <package_name>


  5. I had this in a new project on Windows. npm install had created a node_modules folder for me, but it had somehow created the folder without giving me full control over it. I gave myself full control over node_modules and node_modules\.staging and it worked after that.

  6. finally, I got a solution if you are getting:-

    **npm WARN tar ENOENT: no such file or directory,.......**

    then it is no issue of npm or its version it is os permission issue to resolve this you need to use below command:-

    sudo chown -R $USER:$USER *


    sudo chmod -R 777 *

    then run:-

    sudo npm i 
  7. If your folder already have package.json


    Copy the path of package.json

    Open terminal


    cd your_path_to_package.json

    Press ENTER

    Then Write:

    npm install

    This worked for me

  8. NOTE: if you are experiencing this issue in your CI pipeline, it is usually because npm runs npm ci instead of npm install. npm ci requires an accurate package-lock.json.

    To fix this, whenever you are modifying packages in package.json (e.g. moving packages from devDependencies to Dependencies like I was doing) you should regenerate package-lock.json in your repository by running these commands locally, and then push the changes upstream:

    rm -rf node_modules
    npm install
    git commit package-lock.json
    git push
  9. If you’re trying to npm install on a folder that’s being rsync‘d from somewhere else, remember to add this to your rsync --exclude


    Otherwise, NPM will try to add node_modules and rsync will remove it immediately, causing many npm WARN enoent ENOENT: no such file or directory, open errors.

  10. Delete package.json and package-lock.json file

    Then type npm init

    after that type npm install --save

    finally type npm install

    It works for me


Leave a Comment