[英]Node npm package throw use strict: command not found after publish and install globaly
I am trying to publish npm package, when i am install the package globally and try to run the cli command i get this errors:我正在尝试发布 npm 包,当我全局安装该包并尝试运行 cli 命令时,我收到此错误:
/.nvm/versions/node/v0.12.2/bin/myPack: line 1: use strict: command not found
/.nvm/versions/node/v0.12.2/bin/myPack: line 3: syntax error near unexpected token `('
/.nvm/versions/node/v0.12.2/bin/myPack: line 3: `var _commandLineArgs = require('command-line-args');'
The top of the file that the error refer to:错误所指的文件顶部:
'use strict';
var _commandLineArgs = require('command-line-args');
var _commandLineArgs2 = _interopRequireDefault(_commandLineArgs);
The package.json bin section: package.json bin 部分:
"bin": {
"myPack": "dist/myPack.js"
}
When i am running this in my local development this works well, what is the problem?当我在本地开发中运行它时,它运行良好,有什么问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.