NVM Bash的节点命令行工具:找不到
我正在编写一个简单的节点CLI工具,并且使用NVM遇到麻烦。即使在本地安装了节点并使用NVM使用系统
,并且仍然找不到CLI文件。代码仅包括外壳名称:
#!/usr/bin/env node
console.log("Hello, here is my first CLI tool")
从命令行运行此操作时,我会得到: -bash:cli-project:找不到命令
已经尝试了所有内容。节点为/usr/local/bin/node,甚至添加了。使用了节点的系统位置。已经添加了到 /etc /路径的路径。没有什么可用!有没有人使用NVM构建节点CLI工具的经验? NVM在我的计算机上正确设置,并且.bash_profile很好。非常困惑,为什么它不会走这条简单的途径。
I am writing a simple node CLI tool and having trouble using with NVM. Even installed node locally and use nvm use system
and the CLI file still cannot be found. Code is simply including the shell designation:
#!/usr/bin/env node
console.log("Hello, here is my first CLI tool")
When running this from command line I get this:-bash: cli-project: command not found
Have tried everything. Node is at /usr/local/bin/node, and have even added that. Have used system location of node. Have added the path to /etc/paths. Nothing works! Does anyone have experience building a node CLI tool using NVM how to set up initially? NVM is set up correctly on my machine, and .bash_profile is fine. Very puzzling why it won't pick up this simple path to this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了Shebang外,您还必须做一个小软件包。json魔术似乎是这样的:
然后在应用程序目录中进行
npm链接。
。作品!You have to do a little package.json magic in addition to the shebang it seems like so:
Then do
npm link .
in the application directory. Works!