Reputation: 29
I am looking for a way, where i can run Protractor program by starting from node command. Something like:- node protractor conf.js instead of protractor conf.js
Upvotes: 2
Views: 482
Reputation: 13309
For local installation:
$ node node_modules/.bin/protractor conf.js
For global installation (Linux, Mac):
$ node $(which protractor) conf.js
npm moves executable files, which represent a package, to node_modules/.bin
directory after package installation. Most of the times it is an executable JS file, you'll be fine passing it directly to node. Pretty the same logic is behind a global installation, but in this case you don't know actual path to the executable. There is a utility command which
for Linux and Macs - it returns a path to a binary for a globally available command, in my case it returns:
$ which protractor
$ /home/user/.nvm/versions/node/v0.12.2/bin/protractor
It is possible to evaluate a sub-expression using $(some expression)
, so node will receive a path to executable, so the result would be:
$ node /home/user/.nvm/versions/node/v0.12.2/bin/protractor conf.js
Upvotes: 2