我已经安装了babel core作为依赖项,但是我不断收到错误消息,找不到它

时间:2020-07-03 17:45:33

标签: react-native webpack expo

我试图在Web浏览器中启动一个小型的react-native项目(用expo完成),并且不断出现此错误

     Failed to compile.
C:/Users/SUPPORT/AppData/Roaming/npm/node_modules/expo-cli/node_modules/react-dev-utils/webpackHotDevClient.js
Error: [BABEL] C:\Users\SUPPORT\AppData\Roaming\npm\node_modules\expo-cli\node_modules\react-dev-utils\webpackHotDevClient.js: Cannot find module '@babel/core'

尽管我已经安装了babel和babel core 这是我的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"
  },
  "dependencies": {
    "@expo-google-fonts/inter": "^0.1.0",
    "@react-native-community/toolbar-android": "github:react-native-community/toolbar-android",
    "expo": "~37.0.3",
    "expo-font": "^8.2.1",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
    "react-native-paper": "^3.6.0",
    "react-native-vector-icons": "^6.7.0",
    "react-native-web": "^0.11.7"
  },
  "devDependencies": {
    "@babel/core": "^7.10.4",
    "@babel/preset-env": "^7.10.4",
    "babel-loader": "^8.1.0",
    "babel-preset-expo": "~8.1.0",
    "webpack": "^4.43.0"
  },
  "private": true
}

项目链接:https://github.com/Mai9550/expo_template-react-native-

1 个答案:

答案 0 :(得分:0)

尝试运行 npm install @babel/core --save