我在定义的 package.json 文件中遇到了一个与 bin 模块相关的 command not found...
问题。 为什么会这样呢? 我以为它应该自动将本地命令映射到路径中。
在我的模块的 package.json 文件中:
"bin": {
"testme": "./misc/testme"
},
./misc/testme script:
#!/usr/bin/env node
console.log("this is a test");
它出现在node_modules/.bin目录中。
$ ls node_modules/.bin
acorn escodegen gulp kue-dashboard ncp semver stylus
cake esgenerate gzip-size lessc nopt shjs testme
cleancss esparse handlebars make-plural pretty-bytes sshpk-conv uglifyjs
coffee esvalidate image-size messageformat rc sshpk-sign user-home
dateformat express jade mime retrieve-arguments sshpk-verify uuid
dot-object geojsonhint jsonlint mkdirp rimraf strip-indent watchr
errno grunt js-yaml mustache sails strip-json-comments which
但是,在执行
npm install
之后,当我运行它时,会得到以下错误信息:$ testme
bash: testme: command not found...