Amrit Kaur
Amrit Kaur

Reputation: 23

No such file package.json when running npm i

When I run the following commands:

npm i && npm run

I get the following error:

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

Why am I getting this error and how do I fix it?

Upvotes: 1

Views: 5477

Answers (2)

kumbhani bhavesh
kumbhani bhavesh

Reputation: 2257

First check there is package.json file or not if not create package.json file using npm init

Upvotes: 1

Andrew Li
Andrew Li

Reputation: 57954

The problem is that you're in the wrong directory -- you're in your user directory. If you cloned something from a repository, make sure you navigate to that directory before running npm i:

cd path/to/cloned/project
npm i && npm run <script_here>

Upvotes: 0

Related Questions