当我尝试使用 npm start 时,我的 expo 项目没有启动。 我正在使用的版本是
世博-cli:3.20.5
Node :12.16.3
流程:
世博初始化项目
-> 空白模板
展会开始
运行 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\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="354d51597500021b0c1b00" rel="noreferrer noopener nofollow">[email protected]</a>\src\Project.ts:2080:11)
at Object.startAsync (C:\@expo\<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e362a220e7b796077607b" rel="noreferrer noopener nofollow">[email protected]</a>\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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="395d5c5c4914584a4a505e57790a17091709" rel="noreferrer noopener nofollow">[email protected]</a>: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="52313d20377f382112637c607c65" rel="noreferrer noopener nofollow">[email protected]</a>: 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 start 时,它会不断重复我上面提到的相同错误
最佳答案
问题是 npm install 无法在您的计算机上运行,可能是由于某些缓存问题。您可以运行npm cache clean --force
,然后再次运行npm install
来尝试解决问题
关于node.js - 世博项目尚未启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61827108/