Pratyush Mayank
Pratyush Mayank

Reputation: 173

While doing npm install getting an error as "No such file or directory open"

npm WARN tar ENOENT: no such file or directory, open 'C:{{File_Location}}\node_modules.staging\mocha-20835964\lib\browser\progress.js'

and Error message as npm ERR! Unexpected end of JSON input while parsing near '...int-stylish":"~0.1.3"'

I am trying the command npm-install in visual studio above is the error which I am getting.Please help me for the same.

Upvotes: 13

Views: 20061

Answers (3)

Milad Aghamohammadi
Milad Aghamohammadi

Reputation: 1976

delete package-lock.json first. navigate to the root folder of your project and npm cache clean --force, then try npm install

Upvotes: 16

Vencovsky
Vencovsky

Reputation: 31625

What happen for me to get this error was when I runned npm i and closed or stopped before it was finished. Then to try to "fix" it, I deleted the node_modules folder and runned npm i again and started getting this error.

And the reason why this happens and npm cache clean --force fixes the problem is that npm have a cache on the files that it have already downloaded, but when I remove node_modules, it can't find the files name that are cached and should be in the node_modules and gives this error/warning.

Upvotes: 1

Hemadri Dasari
Hemadri Dasari

Reputation: 33994

To install any dependency using npm is

  npm install module_name 

For eg

  npm install path or npm i path

But not

 npm-install path or npm-install

Upvotes: -3

Related Questions