【问题标题】:"contentful" command not found找不到“内容”命令
【发布时间】:2019-05-05 08:40:41
【问题描述】:

我正在关注这个getting started guide,尽管运行brew upgrade node 并在应该安装的位置安装了contentful-cli 工具,但我遇到了这个问题。任何想法为什么会发生这种情况?

~/Development/misc-dev/travel-blog(master):0 npm i -g contentful-cli  
npm WARN deprecated joi@13.7.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated hoek@5.0.4: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated joi@10.6.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated items@2.1.2: This module has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version of hapi to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
/usr/local/Cellar/node/11.14.0/bin/contentful -> /usr/local/Cellar/node/11.14.0/lib/node_modules/contentful-cli/bin/contentful.js

> spawn-sync@1.0.15 postinstall /usr/local/Cellar/node/11.14.0/lib/node_modules/contentful-cli/node_modules/spawn-sync
> node postinstall

+ contentful-cli@0.26.4
added 490 packages from 231 contributors in 20.129s

~/Development/misc-dev/travel-blog(master):0 contentful --help      
zsh: command not found: contentful

【问题讨论】:

  • 输入 npm bin 并检查路径是否是您的 $PATH 的一部分。
  • @Tico 似乎它不是 $PATH 的一部分。值是这样的:/Users/michael/Development/misc-dev/travel-blog/node_modules/.bin 怎么不属于$PATH
  • which npm 输出/usr/local/bin/npm - 这是预期的吧?有两个 npm 安装吗?
  • npm bin 显示npm 将安装可执行文件的文件夹。 which npm 显示 npm 本身的位置。
  • 很有趣,所以npm install -g <package> 似乎实际上并没有在全球范围内安装.. 你碰巧知道为什么吗?某处是否有像全局.npm.config 文件?

标签: node.js npm contentful


【解决方案1】:

我必须将export PATH="/usr/local/Cellar/node/11.14.0/bin:$PATH" 添加到我的.zshrc 文件中,因为brew 安装的节点包不是我的$PATH 变量的一部分。运行 npm bin -g 帮助我找到了我的全局软件包的安装位置,并为我确认了这一点。感谢@Tico 的指导。

【讨论】:

  • 我在 Windows 上,似乎找不到任何 .zshrc 文件。我也没有 appdata/local/yarn/config 文件夹。做什么?
  • .zshrc 只是我的“zsh”终端的配置文件,所以除非你安装了“zsh”,否则它不会存在。 “Zsh”就像一个自定义版本的 Bash 终端。关于yarn,您需要在 windows 环境中设置纱线(我相信有这方面的指南)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-16
  • 2021-07-11
  • 2017-10-01
  • 2016-05-25
  • 1970-01-01
  • 2021-02-10
相关资源
最近更新 更多