[英]global cli npm package works on windows but not linux
I am wanting to create an npm cli tool, I dug around in bower's code and replicated their basic package.json along with the bin and lib/bin file. 我想创建一个npm cli工具,我在Bower的代码中进行了挖掘,并复制了它们的基本package.json以及bin和lib / bin文件。
On windows it works perfectly, but on linux I just get : No such file or directory
在Windows上,它工作正常,但是在Linux上,我得到的是
: No such file or directory
The npm package is: https://www.npmjs.com/package/quilk npm软件包是: https ://www.npmjs.com/package/quilk
Here is the code, package.json : 这是代码package.json :
{
"name": "quilk",
"version": "0.1.3",
"description": "quilk.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "John Carmichael",
"keywords": [
"builder", "watcher", "fast", "quilk"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/johnc1984/quilk"
},
"main": "lib",
"bin": {
"quilk": "bin/quilk"
},
"files": [
"bin",
"lib"
],
"homepage": "https://github.com/johnc1984/quilk",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"browserify" : "13.1.0",
"concat-files" : "0.1.0",
"chokidar" : "1.6.0",
"fs.extra" : "1.3.2",
"javascript-natural-sort" : "0.7.1",
"jdc-node-cliarg-reader" : "1.0.0",
"less" : "2.7.1",
"node-notifier" : "4.6.1",
"node-minify" : "1.3.9",
"q" : "1.4.1",
"recursive-readdir" : "2.0.0"
}
}
bin/quilk : 垃圾桶/被子
#!/usr/bin/env node
require('../lib/bin/quilk');
lib/bin/quilk lib / bin / quilk
process.bin = process.title = 'quilk';
console.log('This is the quilk script.');
The end result of installing this globally on windows is the console.log is run on the output is This is the quilk script.
在Windows上全局安装此命令的最终结果是console.log在输出上运行
This is the quilk script.
after i simply type quilk
. 在我简单地键入
quilk
。
On Ubuntu 14lts though, trying to run the freshly, globally installed npm module results in the output of : No such file or directory
但是,在Ubuntu 14lts上,尝试运行全新安装的全局安装的npm模块会导致输出
: No such file or directory
What am I missing to get this run on linux? 我要在Linux上运行此功能,我缺少什么?
(when i run the command to list the globally installed npm modules npm ls -g
quilk is listed) (当我运行命令以列出全局安装的npm模块
npm ls -g
quilk时列出)
Further info: I get the exact same issue on the following builds: 进一步的信息:在以下版本上,我得到完全相同的问题:
I found the answer. 我找到了答案。
It turns out to be some kind of bug in npm on windows 10. 事实证明这是Windows 10上npm中的某种错误。
After publishing the same package from a linux box, the npm package now works on both linux and windows leading me to believe that npm publish on windows has some bug in it somewhere. 从Linux盒中发布相同的软件包后,npm软件包现在可以在linux和Windows上运行,这使我相信npm在Windows上发布会在某些地方出现错误。
Issue reported: https://github.com/npm/npm/issues/13808 报告的问题: https : //github.com/npm/npm/issues/13808
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.