Closed davidroman0O closed 8 years ago
It might be something else in your file. Can you show me the whole fine printout?
What is the Node version you have? Can you paste here node --version
and npm --version
?
Hi,
Sorry i was traveling without internet connexion :/
Vorpal is working when i do node index.js
on my terminal.
But when i try to execute it by installing my helloworld project with npm install -g ./
AND when i type the command (hello
) to open it, i got this :
/usr/local/bin/hello: line 1: syntax error near unexpected token
('
/usr/local/bin/hello: line 1: const vorpal = require('vorpal')();'
My versions are :
node --version
: v6.2.1npm --version
: 3.9.3The index.js contains a command hello
that type hello world
in the terminal.
That's all :p
Do i'm missing something?
Thx for answering to this issue, it's cool to see repo with active contributors, i'm sorry for the lack of internet connexion ;)
Can you share your entire index.js ? Why do you have `const ?
I have a project using the entire ES6 capabilities and I'm using babel to compile it down to ES5 so I can safely run vorpal in pretty much any Node distribution.
It is still a WIP but I believe it is going to be useful for your project as well:
https://github.com/grommet/grommet-cli
You can run npm run build
to create the es5 distribution under bin
folder.
Sure, the code is really simple.
const vorpal = require('vorpal')();
vorpal
.command('hello', 'do whatever')
.action(function(args, callback) {
this.log('hello world bro');
callback();
});
vorpal
.delimiter('▲ hello')
.show();
And it's working with node index.js
.
Whatever, with var
it failed too, with the exact same message (except replace var
with const
on the message).
I'll take a look to you grommet-cli
can you try to remove this ? '▲ hello'
Done, same error when installed globally `var vorpal = require('vorpal')();'
I found the issue 💃
You need to include this at the top of your file:
#!/usr/bin/env node
Ooooh ! Perfect ! It's working. 👍
Thx for the help 😉
Hi,
When installing globally and called from an OS X terminal, i got this error message :
/usr/local/bin/mycli: line 1: syntax error near unexpected token
('const vorpal = require('vorpal')();'
Do i'm missing something ?