1

I am new to angular CLI. I have worked in angular 1. I just angular cli using command npm install -g @angular/cli as given on there site quick start guide I also created my first project as per instruction give. But now when i try to run it using ng serve --open i am getting this error.

This is the error.

    `** NG Live Development Server is listening on localhost:4200, open 
    your browser on http://localhost:4200 **
    10% building modules 3/3 modules 0 activeinternal/child_process.js:325            
    throw errnoException(err, 'spawn');
    ^

    Error: spawn EACCES
    at _errnoException (util.js:1041:11)
    at ChildProcess.spawn (internal/child_process.js:325:11)
    at Object.exports.spawn (child_process.js:493:9)
    at module.exports (/var/www/html/my-app/node_modules/opn/index.js:74:26)
    at Server.server.listen (/var/www/html/my-app/node_modules/@angular/cli/tasks/serve.js:213:21)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:105:13)
    at Server.emit (events.js:207:7)
    at emitListeningNT (net.js:1349:10)
    at _combinedTickCallback (internal/process/next_tick.js:135:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
`

I tried by reinstalling angular and recreating the project but still getting error. Is there anything else i need on ubuntu. As i tried installing same project on mac there it worked fine.

11
  • 1
    What happens when you don't use the --open option? Commented Sep 5, 2017 at 6:05
  • Are you using angular or angularJS???? They are completely seperate yet both are tagged. Commented Sep 5, 2017 at 6:07
  • its permission issue .. did u try sudo ? Commented Sep 5, 2017 at 6:09
  • @ParthGhiya yes i tried with sudo also but it was not working Commented Sep 5, 2017 at 6:15
  • 1
    The issue seems to be that ng serve can't open the browser. Most probably because there is no browser on an ubuntu server. Why would there be? And indeed, why do you run angular CLI on a server (unless it's your CI server, but even then, why do you try to open a browser)? Commented Sep 5, 2017 at 6:27

1 Answer 1

1

I had the same problem but not on my server but on my laptop. The problem is that for whatever reason, Angular is not able to open the browser so you should remove the --open or -o option from your command. So remove the option and open the browser manually and navigate to localhost:4200.

But in your case, you need to actually use ng build --prod and deploy the dist folder in your server as you're publishing the project.

Sign up to request clarification or add additional context in comments.

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.