ENOENT:运行 npm install 命令时没有这样的文件或目录

Rak*_*aha 10 node.js npm react-native

当我运行以下命令时:

安装

得到错误:

npm WARN tar ENOENT: 没有这样的文件或目录,打开'D:\Live Project\insyte-mobile\insyte-mobile\node_modules.staging\core-js-c9f4d03d\library\fn\symbol\unscopables.js' 在此处输入图片说明

下面是 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"
  }
}
Run Code Online (Sandbox Code Playgroud)

上面是 package.json 文件。

我还使用了这个项目的另一个代码,但这次我收到以下错误:

在此处输入图片说明

Pus*_*ata 13

先删除package-lock.json然后试试npm install


Egi*_*zas 11

删除node_modules文件夹和package-lock.json,然后运行npm install

  • 遇到同样的问题。 (3认同)

Fre*_*der 5

您需要做的就是

  • 在电脑的根目录中打开终端并运行以下命令:

    killall node

  • 在重新启动新的 Metro 捆绑程序之前,请重新安装对 Yarn 或 npm 的依赖项:

    npm i OR yarn

还有文章: ENOENT:没有这样的文件


小智 -3

您的文件夹中有package.json文件吗?*

要运行 npm install,您需要有一个package.json文件。