Danya
Danya

Reputation: 45

'node run' command in BASH shell scripting

I don't know what to do with 'node run' command so I just simply put it in a script and get the error:

module.js:340
    throw err;
'rror: Cannot find module 'C:\run
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

How do I run the command to start up an instance?

Upvotes: 0

Views: 1460

Answers (4)

ebohlman
ebohlman

Reputation: 15003

Assuming the file's called "run", you have the shebang line you mentioned, the file's permissions are set to executable, and the directory it's located in is on your path, all you need is just plain "run" (if the directory isn't on your path, you need to specify its path).

Upvotes: 0

Peter Lyons
Peter Lyons

Reputation: 145984

Node is an interpreter. If you just want the interactive interpreter, type just node. If you want to run a javascript program, you need to pass the path to your program to node like node myprogram.js.

Upvotes: 1

3on
3on

Reputation: 6339

It is quite simple, you must have a app.js or run.js file right ?

dir the right directory and then:

node you_file.js

(.js is not mendatory)

Upvotes: 1

Jason Brumwell
Jason Brumwell

Reputation: 3550

if for instance you have a script called hello.js and your terminal/cmd prompt is open to that directory you would simply type:

node hello

this is the same as:

node hello.js

Upvotes: 0

Related Questions