gpt4 book ai didi

javascript - Node shell 脚本上没有这样的文件或目录

转载 作者:太空宇宙 更新时间:2023-11-04 10:38:19 25 4
gpt4 key购买 nike

我有一个脚本hello,它包含以下内容:

#!/usr/bin/env node
console.log('hello there!');

当我使用 ./hello 运行它时,我得到以下输出:

$ ./hello 
: No such file or directory

当我使用 node ./hello 运行它时,我得到以下输出:

$ ./hello 
hello there!

这是在 Ubuntu 16.04 上。

最佳答案

这已通过使用 chmod +x hello 设置正确的权限并确保行尾正确来解决。

关于javascript - Node shell 脚本上没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36321931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com