简体   繁体   中英

Error: Cannot find module 'xdl' when running "npm start" in React Native

So I recently started learning React Native by following a Udemy course. Until now, everything has worked just fine, but a couple of days ago I got this error message when running the simple "npm start" command. I've tried a few solutions like reinstalling the node_modules folder, updating everything to the latest version, but that did not help. Has anybody got the solution for this?

node:internal/modules/cjs/loader:936

  throw err;

  ^

Error: Cannot find module 'xdl'

Require stack:
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js

    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

    at Function.Module._load (node:internal/modules/cjs/loader:778:27)

    at Module.require (node:internal/modules/cjs/loader:1005:19)

    at require (node:internal/modules/cjs/helpers:102:18)

    at _xdl (C:\Users\Kori
snik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:152:16)

    at Object.<anonymous> (C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:282:1)

    at Module._compile (node:internal/modules/cjs/loader:1105:14)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

    at Module.load (node:internal/modules/cjs/loader:981:32)

    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [
    'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
    'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
  ]
}

Thanks in advance!

下载 Git Bash 并安装它,安装后以管理员身份打开并编写代码

npm install -g expo-cli --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM