【发布时间】:2017-10-19 00:07:17
【问题描述】:
我在 package.json 中定义的 bin 模块上收到 command not found...。 为什么?我认为它应该自动将本地命令映射到路径中。
在我模块的 package.json 中:
"bin": {
"testme": "./misc/testme"
},
./misc/testme 脚本:
#!/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...
【问题讨论】:
标签: node.js npm npm-install package.json