Cannot find module ...\node_modules\expo\tools\LogReporter
首先,我通过克隆KitchenSink项目创建了一个React Native项目.
链接:
当我通过在项目根目录中发出一系列命令来启动项目时:
npm install然后expo start
我看到app.json也不合适,具体如下:
{ "name": "NativebaseKitchenSink","displayName": "NativebaseKitchenSink" }
发布expo start后,react-native报告在当前目录中找不到app.json.
[17:05:08] Starting project at
D:\Projects\ReactNativeProjects\AwesomeProject [17:05:10] Error:
Missing app.json. See 07001 [17:05:10] Couldn’t start
project. Please fix the errors and restart the project. [17:05:10]
Error: Couldn’t start project. Please fix the errors and restart the
project.
at C:\xdl@51.4.0\src\Project.js:1565:11
at Generator.next ()
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361
at process._tickCallback (internal/process/next_tick.js:68:7)
我将app.json更改为:
{ "expo": { "name": "AwesomeProject","description": "A Kitchen Sink project.","slug": "AwesomeProject","privacy": "public","sdkVersion": "30.0.0","platforms": [ "ios","android" ],"ios": { "supportsTablet": true },"android": { "package": "com.abhsax.first" },"version": "1.0.0","orientation": "portrait","icon": "./assets/logo.png","splash": { "image": "./assets/splashscreen.png","resizeMode": "contain","backgroundColor": "#ffffff" },"updates": { "fallbackToCacheTimeout": 0 },"assetBundlePatterns": [ "**/*" ] } }
当我再次发出npm install时,项目中有一些更新.然后我发出:
expo start
出现此错误:
(node:2044) UnhandledPromiseRejectionWarning: Error: Cannot find
module
‘D:\Projects\ReactNativeProjects\AwesomeProject\node_modules\expo\tools\LogReporter’
如果缺少包,您可以添加它
npm install <package_name> --save
如果你正在使用纱线运行:
yarn add expo