在必须重新安装计算机上的所有组件之前,项目运行正常。运行npm install
然后expo start
后出现以下错误
internal/modules/cjs/loader.js:296
throw err;
^
Error: Cannot find module '/home/amber/Documents/GitKraken/school-notification-1/App/node_modules/@react-native-community/cli/build/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:288:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:515:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:759:27)
at Function.Module._load (internal/modules/cjs/loader.js:677:27)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/home/amber/Documents/GitKraken/school-notification-1/App/node_modules/react-native/local-cli/cli.js:12:11)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32) {
code: 'MODULE_NOT_FOUND',
path: '/home/amber/Documents/GitKraken/school-notification-1/App/node_modules/@react-native-community/cli/package.json',
requestPath: '@react-native-community/cli'
}
Metro Bundler process exited with code 1
这是我的
package.json
{
"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",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^10.0.3",
"@react-navigation/web": "^1.0.0-alpha.9",
"axios": "^0.19.0",
"expo": "^34.0.1",
"expo-asset": "^6.0.0",
"expo-constants": "^6.0.0",
"expo-font": "~6.0.0",
"expo-web-browser": "6.0.0",
"navigationbar-react-native": "0.0.5",
"qs": "^6.8.0",
"react": "16.8.3",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-action-button": "^2.8.5",
"react-native-anchor-carousel": "^3.1.1",
"react-native-app-intro-slider": "^3.0.0",
"react-native-calendars": "^1.210.0",
"react-native-circle-drawer": "^1.0.0",
"react-native-drawer-menu": "^0.2.5",
"react-native-elements": "^1.1.0",
"react-native-gesture-handler": "^1.3.0",
"react-native-global-props": "^1.1.5",
"react-native-htmlview": "^0.15.0",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-popup-dialog": "^0.18.3",
"react-native-side-drawer": "^1.1.11",
"react-native-side-menu": "^1.1.3",
"react-native-sidebar": "^0.3.0",
"react-native-web": "^0.11.4",
"react-navigation": "^3.11.0"
},
"devDependencies": {
"babel-preset-expo": "^6.0.0",
"jest-expo": "^34.0.0"
},
"private": true
}
最佳答案
安装此软件包。
npm i @react-native-community/cli
关于react-native - React Native:找不到模块@ react-native-community-cli,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57864453/