bin 不被识别为内部或外部命令。 npm脚本

bin is not recognized as an internal or external command. npm script

我是 node/npm 的新手,在尝试启动 npm 脚本时遇到问题。

当我尝试 运行 像下面这样的基本脚本时,它给我错误消息“bin 未被识别为内部或外部命令”。我想我已经 运行 成功地完成了我以前制作的一些脚本,所以我不知道是我的 npm 坏了还是我做错了什么。

#! node

const app = require('../lib/app')
const config = {
  port: 8080
}

app.listen(config.port, () => {
  console.log(`Chat is waiting for you at http://localhost:${config.port}`)
})

Screenshot bin error

我已经尝试卸载 - 重新安装。 我还检查了这个 post: 并尝试 运行 npm install -g 失败。

我在 Windows。

没关系。

我才明白是怎么回事。该代码的灵感来自 Linux 用户,该用户在第一行有“!env 节点”。

我在 Windows 所以我删除了它,但结果是,脚本只是试图 运行 “bin/start” 而不是“节点 bin/start ".

荒谬的错误,但好吧,至少我学到了一些东西