Home > Back-end >  When I enter npm i can not install npm to this projecrt because this error is coming
When I enter npm i can not install npm to this projecrt because this error is coming

Time:01-01

npm ERR! code ENOENT

npm ERR! syscall open npm ERR! path C:\Users\Navodhya Yasisuru\OneDrive\Documents\portfolio_website-STARTER/package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Navodhya Yasisuru\OneDrive\Documents\portfolio_website-STARTER\package.json'

npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Navodhya Yasisuru\AppData\Local\npm-cache_logs\2023-01-01T05_01_44_757Z-debug-0.log

I tried to run npm i in this project

CodePudding user response:

npm i or npm install requires a package.json file in your directory, but it couldn’t find it. My guess is you ran it without first running npm init to create it.

Important detail in error message:

ENOENT: no such file or directory, open '...\package.json'

CodePudding user response:

This error is caused due to missing package.json. Possible reasons:

  1. Not creating package.json for new npm module
  2. Deleting it accidentally
  3. Selecting invalid directory before running npm i
  • Related