我正在尝试创建要运行cli的节点cli。/index My package.json '
{
"name": "cli",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"./index": "index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
'
我在bin中添加了./index,但当尝试运行./index时,显示没有这样的文件或目录:./索引
但是当尝试只运行索引时,我想用./index运行
1条答案
按热度按时间v1uwarro1#
根据npm提供的文档(https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin),设置“bin”应该是这样的: