结合bin和安装脚本

时间:2016-11-30 09:17:23

标签: node.js package.json

鉴于以下摘自package.json:

{
  "name": "foo",
  "version": "0.0.1",
  "description": "Foo",
  "main": "bin/index.js",
  "bin": "bin/index-cli.js",
  "private": true,
  "scripts": {
    "install": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  ...
}

npm install失败了:

npm ERR! enoent ENOENT: no such file or directory, chmod '/home/mk/work/my-project/node_modules/foo/bin/index-cli.js'

这是因为在npm尝试创建sym链接之前,没有执行从src / index-cli.ts生成bin / index-cli.js的安装脚本(tsc-typescript编译器)。

问题:有一个由安装脚本生成的bin的正确方法是什么?

0 个答案:

没有答案