javascript - JScript compilation error nodejs command line tool - Stack Overflow

So I'm trying to build a mand line tool using node.js but am running into problems trying to run t

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
Add a ment  | 

1 Answer 1

Reset to default 4

Found the information from this tutorial

npm install -g

test

Hello, world!

Did you try to install it before running it?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744732082a4590525.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信