admin管理员组文章数量:1389758
So I'm trying to build a mand line tool using node.js
but am running into problems trying to run the tool. Here's the simple code that I have.
src/main.js
#!/usr/bin/env node
'use strict';
(function main() {
console.log('Hello World!');
})();
and in my packages.json
I have this added
"bin": {
"test": "./src/main.js"
}
But when I try and execute test
from the mand line I get a Microsoft JScript pilation error at line 1 char 1 invalid character code 800A03F6.
Any ideas what I might be missing? Thanks :)
So I'm trying to build a mand line tool using node.js
but am running into problems trying to run the tool. Here's the simple code that I have.
src/main.js
#!/usr/bin/env node
'use strict';
(function main() {
console.log('Hello World!');
})();
and in my packages.json
I have this added
"bin": {
"test": "./src/main.js"
}
But when I try and execute test
from the mand line I get a Microsoft JScript pilation error at line 1 char 1 invalid character code 800A03F6.
Any ideas what I might be missing? Thanks :)
Share Improve this question asked May 24, 2018 at 2:08 rycireserycirese 1992 silver badges16 bronze badges 2- How do you run this ? Seems like Windows Scripting Host processes your code, not Node – Marged Commented May 24, 2018 at 2:11
-
I just type
test
into the mand line – rycirese Commented May 24, 2018 at 2:13
1 Answer
Reset to default 4Found the information from this tutorial
npm install -g
test
Hello, world!
Did you try to install it before running it?
本文标签: javascriptJScript compilation error nodejs command line toolStack Overflow
版权声明:本文标题:javascript - JScript compilation error nodejs command line tool - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744732081a2622106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论