编程语言
首页 > 编程语言> > node开发命令行脚本 / commander

node开发命令行脚本 / commander

作者:互联网

1. 脚本第一行添加 #!/usr/bin/env node

// index.js
#!/usr/bin/env node
console.log('hello world')

2. package.json 添加bin

{
  "name": "hello-test",
  "version": "1.0.0",
  "bin":{
   "hello-cli":"index.js"
  }
}

3. npm link

node开发命令行脚本
https://www.cnblogs.com/lcosima/p/11482428.html

标签:node,bin,env,index,commander,usr,命令行,hello
来源: https://www.cnblogs.com/pengchenggang/p/15088483.html