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?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744732082a4590525.html
评论列表(0条)