1

I am attempting to get a better understanding of nodejs so that I can get an IntelliJ plugin working.

I have installed NodeJS on my Windows 7 machine and verified that it works from the command line (node, then did a 2+2 it answered 4).

I then git cloned the AngularJS Seed project (https://github.com/angular/angular-seed) and proceeded to get that running (npm install, npm start) and all was good.

But then I tried using node to directly kick off the http-server module with the following command line from the AngularJS source directory.

node node_modules\.bin\http-server -a localhost -p 8000

and

node node_modules\.bin\http-server.cmd -a localhost -p 8000

Both commands give me the following error -

SyntaxError: Unexpected token ILLEGAL at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3

Am I missing something easy here since I am new to NodeJS or am I doing something wrong?

2 Answers 2

1

If you want to run http-server directly, you should install it globally:

npm install http-server -g

Then you can run the following:

http-server -a localhost -p 8000
Sign up to request clarification or add additional context in comments.

2 Comments

You could explain what the error message means, and how your solution solves that...
I'm also trying to use the NodeJS plugin in IntelliJ (I should have added that, appologies) which calls Node to do things. As I said, npm start does work and that wasn't my question. My question was why when I try it with Node directly does it fail, because this is how the NodeJS plugin in IntelliJ works.
0

Try -

Working dir: /path/to/your/package.json

JavaScript file: /path/to/global/node_modules/npm/bin/npm-cli.js

Application parameters: run start

From here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.