我已经在笔记本电脑上安装了Amplify cli,即使它抛出错误,我还是使用了amplify configure
命令,它仍然有效。但是现在,当我尝试在另一台笔记本电脑上执行相同的操作时,它会引发错误“ -bash:amplify:找不到命令”。下面是整个错误块:
npm WARN deprecated @types/[email protected]: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: Use uuid module instead
/Users/tarungajjar/.npm-global/bin/amplify -> /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/bin/amplify
> [email protected] install /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy/build'
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
> [email protected] install /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/zmq
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/zmq/build'
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/zmq
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
> @aws-amplify/[email protected] postinstall /Users/tarungajjar/.npm-global/lib/node_modules/@aws-amplify/cli
> node scripts/post-install.js
Ignore installation errors for optional dependencies: gyp, fs-ext
----------------------------------------
Successfully installed the Amplify CLI
----------------------------------------
Javascript Getting Started - https://aws-amplify.github.io/docs/js/start
Android Getting Started - https://aws-amplify.github.io/docs/android/start
iOS Getting Started - https://aws-amplify.github.io/docs/ios/start
npm WARN @conduitvc/[email protected] requires a peer of leveldown@~1.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN @conduitvc/[email protected] requires a peer of ioredis@^1.15.1 but none is installed. You must install peer dependencies yourself.
npm WARN @conduitvc/[email protected] requires a peer of mongodb@~2.1.4 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@aws-amplify/cli/node_modules/snappy):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@aws-amplify/cli/node_modules/zmq):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ @aws-amplify/[email protected]
amplify命令在另一台笔记本电脑上运行正常,不会出现与上述相同的错误。我什至尝试按照GitHub上用户的建议使用npm install -g @aws-amplify/cli --unsafe-perm=true
安装cli。如果有人可以帮我解决这个问题,那就太好了。 TIA
尝试以下命令
sudo npm i --unsafe-perm
如果不起作用,请尝试以下操作
sudo rm -rf〜/ .node-gyp
sudo npm缓存清理-f
sudo npm install -g n
sudo n稳定
sudo npm i --unsafe-perm