简体   繁体   中英

Starting app causes Cannot find module error

When I start my react-native app in git-bash it show me this message.

问题的图片

I have removed node.js and reinstalled it and cleaned the cache. I have tried every solution in Stack Overflow and GitHub but none are working for me

   $ npm start

> @ start C:\Users\youse\OneDrive\╪│╪╖╪ص ╪د┘„┘à┘â╪ز╪ذ\0\rn-starter
> expo start

[20:51:21] Starting project at C:\Users\youse\OneDrive\╪│╪╖╪ص ╪د┘„┘à┘â╪ز╪ذ\0\rn-starter
[20:51:45] Cannot find module 'C:\Users\youse\AppData\Roaming\npm\node_modules\expo-cli\node_modules\send\node_modules\mime\mime.js'. Please verify that the package.json has a valid "main" entry
[20:51:45] Error: Cannot find module 'C:\Users\youse\AppData\Roaming\npm\node_modules\expo-cli\node_modules\send\node_modules\mime\mime.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:320:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:533:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
    at Function.Module._load (internal/modules/cjs/loader.js:742:27)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\youse\AppData\Roaming\npm\node_modules\expo-cli\node_modules\send\index.js:24:12)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\youse\AppData\Roaming\npm-cache\_logs\2020-08-28T17_51_45_566Z-debug.log

package.json file is below

    {
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.5",
    "core-js": "^3.6.5",
    "expo": "~36.0.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-reanimated": "~1.4.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.12",
    "react-navigation": "^4.1.0",
    "react-navigation-stack": "^2.0.16"
  },
  "devDependencies": {
    "babel-preset-expo": "~8.0.0",
    "@babel/core": "^7.0.0"
  },
  "private": true
}

我用这条线找到了解决我的问题的方法

npm i expo-cli -g

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