安装React-native日历会中断安装

时间:2018-08-24 21:55:15

标签: reactjs react-native npm

我有些困惑,为什么为本机日历安装两个不同的npm安装会破坏解决方案。我正在通过expo运行本机,并且在安装日历之前运行良好。

但是在安装了两个      react-native-general-calendars  要么      react-native-calendars 运行后,我在控制台中收到此错误      expo start

> [17:30:29] Starting project at --location--
[17:30:33] Error: React native is not installed. Please run `npm install` in your project directory.
[17:30:33] Couldn't start project. Please fix the errors and restart the project.
[17:30:33] Set EXPO_DEBUG=true in your env to view the stack trace.

我运行npm install并得到以下错误:

> [17:33:34] Starting project at --location--
[17:33:40] --location--\node_modules\react-native\local-cli\server\checkNodeVersion.js:43
[17:33:40]     );
[17:33:40]     ^
[17:33:40] SyntaxError: Unexpected token )
[17:33:40]     at createScript (vm.js:56:10)
[17:33:40]     at Object.runInThisContext (vm.js:97:10)
[17:33:40]     at Module._compile (module.js:542:28)
[17:33:40]     at Object.Module._extensions..js (module.js:579:10)
[17:33:40]     at Module.load (module.js:487:32)
[17:33:40]     at tryModuleLoad (module.js:446:12)
[17:33:40]     at Function.Module._load (module.js:438:3)
[17:33:40]     at Module.require (module.js:497:17)
[17:33:40]     at require (internal/module.js:20:19)
[17:33:40]     at Object.<anonymous> (--location--\node_modules\react-native\local-cli\cli.js:17:1)
[17:33:40] Metro Bundler process exited with code 1
[17:33:40] Set EXPO_DEBUG=true in your env to view the stack trace.

这是我的package.json:

 {
  "name": "my-new-project",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "expo": "^29.0.0",
    "react": "^16.4.2",
    "react-native": "^0.56.0",
    "react-native-general-calendars": "^1.7.2",
    "react-navigation": "^2.9.3"
  },
  "devDependencies": {
    "jest-expo": "^29.0.0"
  }
}

当我卸载日历时,仍然出现错误。不确定如何获取expo以停止引发错误。有人知道如何解决这个问题吗?

0 个答案:

没有答案