Reputation: 11
I'm encountering an issue while trying to run npm start
in my Node.js project directory. Despite the package.json
file being present in the correct directory (C:\Myfirstproject\Vinci\Projet_Web
), I'm receiving an error message stating:
npm ERR! code ENOENT.
npm ERR! syscall open
npm ERR! path C:\Myfirstproject\Vinci\Projet_Web\package.json
npm ERR! errno -4058
npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open 'C:\Myfirstproject\Vinci\Projet_Web\package.json
I've double-checked the file's existence and ensured that the path specified in the error message is accurate. I'm unsure why npm is unable to locate the package.json
file. What might be causing this issue and how I can resolve it?
Contents of my package.json
file:
{
"name": "projet-web-2024",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "nodemon app.js",
"test": "eslint --rulesdir ./tests ."
},
"dependencies": {
"bcrypt": "^5.1.1",
"better-sqlite3": "^9.4.3",
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"express-session": "^1.17.3",
"hbs": "~4.0.4",
"http-errors": "~1.6.3",
"morgan": "~1.9.1",
"multer": "^1.4.5-lts.1",
"validator": "^13.9.0"
},
"devDependencies": {
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-hbs": "^1.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.4",
"eslint-plugin-promise": "^6.0.0",
"nodemon": "^2.0.15"
}
}
Upvotes: 0
Views: 72
Reputation: 33
You may not have initialised the package.json file with the npm init
command. A similar issue was discussed here.
Upvotes: 0