![](/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.