npm - 一般安装和运行 aws-amplify cli 和全局 npm 包的问题
问题描述
我正在尝试在我的 Mac 上安装 aws amplify cli。它似乎可以安装,但是当我之后运行它时,它会响应
bash: amplify: command not found
我在想它可能与全局 npm 包的目录有关,所以我跑了
$ npm -g root
哪个返回:
/usr/local/lib/node_modules/node/lib/node_modules
我的 node_modules 放在另一个节点模块文件夹中似乎很奇怪。
当我运行时:
$ which npm
它返回:
/usr/local/bin/npm
我还尝试使用命令列出我的全局包
$ npm list -g --depth=0
哪个返回:
/usr/local/lib/node_modules/node/lib
├── @angular/cli@7.3.1
├── @aws-amplify/cli@1.5.1
├── ng@0.0.0
├── npm@6.9.0
├── npm-check@5.9.0
├── tsc@1.20150623.0
├── typeorm@0.2.16
└── typescript@3.2.2
有人可以帮我解决这个问题吗?
解决方案
如果有人在 Mac 上使用curl安装 amplify ,那么您需要编辑您的 .zprofile(如果您使用的是 zsh 终端)或 .bash_profile。打开你的终端
1. cd
2. vim .zprofile
3. Press i, then paste this line
export PATH="$HOME/.amplify/bin:$PATH"
4. Press Esc and :wq to save this file
5. Restart your terminal
推荐阅读
- python-3.x - 试图用一个使用 pyfiglet 的 python 代码和一些带有冲洗的打印件制作一个 .exe
- stata - 在 stata 的同一观察中创建变量组
- java - 使用 lombok 和 jackson 预处理 json
- python - 如何在多个环境中重用 python 脚本(在 Pycharm 中)
- django - 在模板中调用嵌套/子表单的特定字段
- yocto - “/tmp”临时目录中没有足够的磁盘空间。启动需要 100 MB
- flutter - 如何用颤振绘制这个形状
- javascript - 将 forEach 用于对象时,如何按顺序获取对象?
- python - 将一个字符串与另一个字符串的多个子字符串进行比较
- java - 您可以将文本字段中的字节转换为字符串吗?