1

I want to serve my app without using cd

I tried this:

  1. ng s --servePath=\Projects\front-user\ --optimization --aot
  2. And this: ng s \Projects\front-user\ --optimization --aot

But I got Local workspace file ('angular.json') could not be found because I am doing something wrong with the path.

If I do cd /Projects/front-user/ && ng s --aot --optimization works perfectly but I would like to know if there is a way to specify the project path.

Thanks!

3
  • 1
    you can write a npm script scripts: {"other" : "cd otherfolder && ng s "} then you can run npm run other Commented Sep 27, 2019 at 9:10
  • Its a good way. But is the only way to specify a path with ng s ? Commented Sep 27, 2019 at 9:12
  • sadly not possible Commented Sep 27, 2019 at 10:11

1 Answer 1

3

Not it is not possible because ng s search in the current directory for a angular.json.

If you run ng s Projects/front-user/ if will be understood as the project name.

The best solution i can think of is a npm script in you package.json like

"scripts": {
    "start": "cd folder && ng serve",
    ...
}

Currently there is no parameter for such action, for all parameter see here.

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.