'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



Solution 1:[1]

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

Solution 2:[2]

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

Solution 3:[3]

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

Solution 4:[4]

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

Solution 5:[5]

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).

Solution 6:[6]

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

Solution 7:[7]

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.

Solution 8:[8]

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

Solution 9:[9]

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pushplata
Solution 2 Egizas
Solution 3 FreakyCoder
Solution 4
Solution 5 Tellisense
Solution 6 Expert Soft Tech Solution
Solution 7
Solution 8 Omkar Bhavare
Solution 9 Yao Renaud Woana