Rakesh kushwaha
Rakesh kushwaha

Reputation: 759

ENOENT: no such file or directory when running npm install command

When I run npm install, I getting the following error,

npm WARN tar ENOENT: no such file or directory, open 'D:\Live Project\insyte-mobile\insyte-mobile\node_modules.staging\core-js-c9f4d03d\library\fn\symbol\unscopables.js'

Here is a screen shoot of the error Error screenshot:

Here is my package.json

{
  "name": "tonight-mobile",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "jest-expo": "~27.0.0",
    "react-test-renderer": "16.3.1"
  },
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "eject": "expo eject",
    "initial-android": "npm install && npm run android",
    "initial-ios": "npm install && npm run ios",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "test": "jest",
    "postinstall": "rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "expo": "^32.0.0",
    "expo-image-picker": "^5.0.2",
    "firebase": "^5.7.1",
    "firebase-admin": "^8.5.0",
    "firebase-functions": "^3.2.0",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-firebase": "^5.1.1",
    "react-native-image-crop-picker": "^0.21.3",
    "react-native-image-picker-form": "^0.2.5",
    "react-native-maps": "^0.21.0",
    "react-native-responsive-image": "^2.3.1",
    "react-native-swiper": "^1.5.14",
    "react-native-vector-icons": "^5.0.0",
    "react-navigation": "^2.13.0",
    "react-navigation-tabs": "^1.0.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-persist": "^5.10.0",
    "redux-persist-filesystem-storage": "^1.3.2",
    "redux-thunk": "^2.3.0",
    "tcomb-form-native": "^0.6.20"
  }
}

above is the package.json file.

I have also used another code of this project, but this time I'm getting following error :

enter image description here

Upvotes: 36

Views: 125625

Answers (11)

Deepak paramesh
Deepak paramesh

Reputation: 864

The "solutions" in anything I found online are not actually solutions

I Followed these steps.

  1. Delete package-lock.json works but is a very weak workaround as the package-lock.json is an important file that shouldn't need to be deleted.

  2. Follow the below command

rm -rf node_modules && npm cache clean --force

  1. Now run npm i .

Upvotes: 2

sateesh
sateesh

Reputation: 92

My simple solution for this error:

"npm WARN tar ENOENT:no such file or directory

Not only for ENOENT if all files in npm modules shows this kinds of error.

  1. Go to your command prompt
  2. Check for npm version(npm -v)
  3. If its giving a version then type command npm init and click on enter for whatever it asks
  4. After completing all the steps and then again try to create one angular project. It will be created without any errors in node modules.

Upvotes: 2

Omkar Bhavare
Omkar Bhavare

Reputation: 37

npm ERR! code ENOENT npm ERR! syscall open npm ERR! path E:\Projects\package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'E:\Projects\package.json' npm ERR! enoent This is related to npm not being able to find a file.

Solution ==> Check the root directory you might be outside the root directory or in wrong folder path has been opened

Upvotes: -1

Follow this step:

  1. Delete node_modules folder and package-lock.json file
  2. Run this command: npm cache clean -force
  3. Then run this command: npm install (if the issue is not yet fixed try the following 4th step.)
  4. Run this command npm install -g npm,then npm install
  5. Finally run this command: npm start

Upvotes: 2

abc
abc

Reputation: 125

I suspect you do not have git installed on your computer. This is particularly true if you are getting this error at the bottom of your log:

npm ERR! syscall spawn git

If so, then you need to install git from here: https://git-scm.com/downloads.

I had the same problem as you, and once I installed git, the problem went away.

Upvotes: -2

Tellisense
Tellisense

Reputation: 2014

Check the node version, if the application was build using an older node version then you can downgrade your local environment node version using NVM (node version manager).

Upvotes: 0

Pushplata
Pushplata

Reputation: 582

First delete the package-lock.json and then try npm install

Upvotes: 29

FreakyCoder
FreakyCoder

Reputation: 869

All you need to do is

  • Open a terminal in your pc's root and run this command:

    killall node

  • Before restart the new metro bundler please reinstall the dependencies on yarn or npm :

    npm i OR yarn

Also the article: ENOENT: no such file

Upvotes: 5

Prabhunath Yadav
Prabhunath Yadav

Reputation: 185

Please check your current working directory. if you have created project using npx react-native init demo

then navigate inside project from terminal using cd demo npm install

will install all npm modules and you can also check installed packages in the directory: demo/node_modules

also if project is expo base then run expo eject to eject from expo

Upvotes: 0

Egizas
Egizas

Reputation: 317

Delete node_modules folder and package-lock.json, then run npm install

Upvotes: 11

Yao Renaud Woana
Yao Renaud Woana

Reputation: 67

Do you have a package.json file in the folder ?*

To run npm install you need to have a package.json file.

Upvotes: -3

Related Questions