javascript - 使用 macOS High Sierra 安装 React Native Expo 时出错
问题描述
尝试在 Visual Studio 代码终端中安装 Native React 时不断出错。
这是我的节点和 npm 版本。
Desktop Allen$ $ npm -v
6.14.14
Desktop Allen$ node -v
v14.17.4
尝试安装 expo 时出现以下错误:
Desktop Allen$ sudo npm i -g expo-cli
npm WARN deprecated graphql-tools@3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated uuid@3.0.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
/usr/local/bin/expo -> /usr/local/lib/node_modules/expo-cli/bin/expo.js
/usr/local/bin/expo-cli -> /usr/local/lib/node_modules/expo-cli/bin/expo.js
> fsevents@1.2.13 install /usr/local/lib/node_modules/expo-cli/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
sh: node: command not found
> fsevents@1.2.13 install /usr/local/lib/node_modules/expo-cli/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
sh: node: command not found
> core-js@2.6.12 postinstall /usr/local/lib/node_modules/expo-cli/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
sh: node: command not found
npm WARN @apideck/better-ajv-errors@0.2.5 requires a peer of ajv@>=8 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/expo-cli/node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 install: `node install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/expo-cli/node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 install: `node install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! core-js@2.6.12 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js@2.6.12 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /user/.npm/_logs/2021-08-06T05_18_07_192Z-debug.log
假设警告不是问题,但是我不断收到上面不允许安装 expo 的错误。认为这是权限问题,我尝试了以下操作:
Desktop Allen$ sudo chmod -R 777 '/Users/Allen/.npm'
Password:
Desktop Allen$
尝试重新安装并有相同的错误。
有什么建议么?
解决方案
推荐阅读
- javascript - 当密钥未知时,如何获取值
- google-cloud-dataflow - Apache Beam TextIO.Read 行号
- r - 过滤组 data.table 上的值
- php - 路线 [voyager.database.bread.edit] 未定义。航海者 Laravel 5.6
- java - javafx 将数据发送回前一个控制器
- swift - 不同视图控制器上的 Xcode Swift 导航栏
- excel - 什么excel公式可以用来获取以下数据的平均值?以及如何应用它?
- python - 添加 x 的概率和转换百分比
- javascript - PHP "??" javascript中的运算符
- java - jackson注解隐藏json类型