![](/img/trans.png)
[英]Build of React application on AWS Amplify fails in Amplify Console
[英]AWS-Amplify-cli fails to install on Mac
尝试安装 AWS-Amplify-CLI 并遵循此
当我运行npm install -g @aws-amplify/cli
或sudo npm install -g @aws-amplify/cli
时出现以下错误
node-pre-gyp WARN 使用请求 node-pre-gyp https 下载 node-pre-gyp WARN 预建二进制文件无法安装 fsevents@1.2.7 和 node@11.8.0(node-v67 ABI,未知)(下降返回源代码使用 node-gyp 编译)node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/ lib' gyp ERR:配置错误 gyp ERR:堆栈错误,EACCES。 没有权限。 mkdir '/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/build' gyp 错误。 系统 Darwin 18.2.0 gyp ERR。 命令 "/usr/local/lib/node_modules/node/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback -to-build" "--module=/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/ fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node- v67-darwin-x64” “--napi_version=4” “--node_abi_napi=napi” gyp ERR: cwd /usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents gyp呃。 节点 -v v11.8.0 gyp 错误。 节点 gyp -v v3:8:0 gyp 错误。 不行 node-pre-gyp ERR。 构建错误 node-pre-gyp ERR: stack Error: Failed to execute '/usr/local/lib/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node -gyp.js 配置 --fallback-to-build --module=/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node- v67-darwin-x64/fse:node --module_name=fse --module_path=/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/ node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1) node-pre-gyp ERR:堆栈在 ChildProcess。 (/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js.83.29) node-pre-gyp错误:在 ChildProcess 处堆栈:发出 (events.js.197.13) node-pre-gyp 错误。 堆栈在 maybeClose (internal/child_process.js.978.16) node-pre-gyp ERR。 堆栈在 Process.ChildProcess._handle.onexit (internal/child_process.js.265.5) node-pre-gyp ERR。 系统 Darwin 18.2.0 node-pre-gyp ERR。 命令“/usr/local/lib/node_modules/node/bin/node”“/usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/cli/node_modules/fsevents/node_modules/node-pre- gyp/bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR: cwd /usr/local/lib/node_modules/node/lib/node_modules/@aws-amplify/ cli/node_modules/fsevents node-pre-gyp 错误。 node-v v11.8:0 node-pre-gyp ERR: node-pre-gyp -v v0.10.3 node-pre-gyp ERR: not ok 无法执行'/usr/local/lib/node_modules/node/bin /node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js 配置--fallback-to-build --module=/usr/local/lib/node_modules/node/lib /node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/node /lib/node_modules/@aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1) npm WARN graphql-import@0.4 .5 需要 graphql@^0.11.0 的同行 || ^0.12.0 || ^0.13.0 但没有安装。 您必须自己安装对等依赖项。 npm 警告可选跳过可选依赖项:fsevents@1.2.7(node_modules/@aws-amplify/cli/node_modules/fsevents):npm 警告可选跳过可选依赖项:fsevents@1.2.7 安装:
node install
88270488DKIPPING OPENCTIONAL 可选警告7退出状态 1
- @aws-amplify/cli@0.1.44 在 57.461 秒内添加了 1 个贡献者的 2 个包,删除了 6 个包并更新了 29 个包
当我分别安装node-pre-gyp
和node-gyp
时,我得到了同样的错误。
我在项目文件夹上有CHMOD 0777
,然后尝试在没有 -g 标志的情况下再次安装,但出现同样的错误。
操作系统:Mojave 10.14.2
节点:v11.8.0
npm:6.5.0
您也可以尝试以下对我有用的命令:
sudo npm install -g @aws-amplify/cli --unsafe-perm=true
固定的。
我的 node 和 npm 全局安装似乎存在问题,缺少/不正确的条目:
修复是完全删除节点和 npm,使用 nvm 重新安装。 我遵循了这些:
请注意:
我有一个类似的问题。 出于某种奇怪的原因,我需要设置 python 版本。 类似 npm config set python python2.7 && npm install
Amplify 需要本地资源,并且需要与环境绑定,尤其是在它们之间切换时。
就像 Mac 上的 dev/prod 或本地开发人员与 Windows 中的某些开发人员。
看看放大环境添加
我通过 brew 安装了节点,所以我的修复是:
完全卸载节点
brew卸载--force节点
通过: https://nodejs.org/es/安装节点,它会自动更新 PATH
安装放大:
sudo npm install -g @aws-amplify/cli --unsafe-perm=true
这就是我为解决这个问题所做的:
node
重新安装到最新版本。 您可以使用以下步骤执行此操作:- sudo npm cache clean -f (force) clear you npm cache - sudo npm install -gn install n (this might take a while) - sudo n stable upgrade to the current stable version
请注意,sudo 可能会提示您输入密码。
amplify
:sudo npm install -g @aws-amplify/cli --unsafe-perm=true
最后一个过程可能需要一段时间。
全局安装包时出现 EACCES 权限错误
npm 卸载-g @aws-amplify/cli
sudo 放大卸载
用节点版本管理器重新安装npm,我推荐这个指南https://tecadmin.net/install-nvm-macos-with-homebrew/
在命令行上为全局安装创建一个目录
mkdir ~/.npm-global
npm 配置集前缀 '~/.npm-global'
导出 PATH=~/.npm-global/bin:$PATH
来源 ~/.zshrc
来源 ~/.profile
npm 安装-g @aws-amplify/cli
虽然接受的解决方案最初似乎有效,但我在使用 amplify-cli 时遇到了进一步的EACCES: permission error
。 我解决它的方法是按照npmjs 文档的建议解析EACESS permissions
。
指示:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
nano ~/.profile
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
.npm-global/bin
来测试添加的路径是否有效:echo $PATH
npm install -g @aws-amplify/cli
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.