当我尝试使用npm start时,我的expo项目没有启动。 我正在使用的版本是
Expo-cli:3.20.5
节点:12.16.3
流量:
expo init项目
->空白模板
博览会开始
运行expo start命令后,出现以下错误
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
at Object.getExpoSDKVersion (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Project.ts:35:9)
at ensureConfigHasDefaultValues (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:419:22)
at fillAndReturnConfig (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:101:10)
at configureProjectAsync (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:281:25)
at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:157:34)
at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:334:16
at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
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 WARN Local package.json exists, but node_modules missing, did you mean to install?
然后如上述第一行所述,我运行了npm install expo
运行用于安装expo的命令后,出现以下错误
Error: React Native is not installed. Please run `npm install` in your project directory.
Couldn't start project. Please fix the errors and restart the project.
at startExpoServerAsync (C:\@expo\xdl@57.9.5\src\Project.ts:2080:11)
at Object.startAsync (C:\@expo\xdl@57.9.5\src\Project.ts:2397:5)
at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:170:3)
at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR! Failed at the @ start script.
然后我运行了上述错误中提到的npm install,但随后出现此错误
npm WARN deprecated deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
在那之后,当我再次尝试启动npm时,它会通过上述相同的错误不断重复自身
答案 0 :(得分:2)
问题是npm安装在您的计算机上无法正常运行,可能是由于某些缓存问题所致。您可以先运行npm cache clean --force
,然后再运行npm install
来解决问题
答案 1 :(得分:1)
Illustration 我遇到了同样的问题并清理了我的节点模块。但是问题又回来了,因为我以错误的方式杀死了我的服务器。所以我再次清理了 repo 并正确关闭了我的服务器。现在我一直正确关闭我的服务器。该问题暂时没有再次发生。
=> 不要杀死你的 cmd,你必须通过为 win 10 执行 CMD+C
来正确关闭服务器。