“/”未被识别为内部或外部命令

"/" is not recognized as an internal or external command

今天,我在编写几个npm包和一些需要反复准备的东西。

所以我想编写一个 CLI 来快速完成这些事情。

这里是 src/cli.js 代码:

export function cli(args){
  console.log(args);
}

这里是 package.json 代码:

{
  "name": "my-project",
  "version": "1.0.0",
  "description": "A CLI to bootstrap new project",
  "main": "src/index.js",
  "bin": {
    "@kensoni/my-project": "bin/my-project",
    "my-project": "bin/my-project"
  },
  "publishConfig": {
    "access": "public"
  },
  "keywords": [
    "cli"
  ],
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Ken Nguyen",
  "license": "MIT",
  "dependencies": {
    "arg": "^5.0.0",
    "esm": "^3.2.25",
    "inquirer": "^8.1.1"
  }
}

这里是 bin/my-project 代码:

#!/usr/bin/env/ node

require = require('esm')(module /*, options*/);
require('../src/cli').cli(process.argv);

在我执行命令 npm link 并打开一个新的 cmd 类型 my-project 后,我收到以下消息:

'"/"' is not recognized as an internal or external command,
operable program or batch file.

我正在使用这些版本:

关于它如何工作的任何想法。

提前致谢。

去掉env后面的“/”

#!/usr/bin/env node

//...