How do I get ng command to work in Codespaces?

Does the ng command work in Codespaces? I have just started playing with the beta and am wondering how to get my code to actually compile as it does in my VS Code environment.

Hi Abhijit, the Angular CLI isn’t installed by default; you need to install the Angular CLI using the terminal feature in the Codespace:

  1. Open the Menu > Terminal > New Terminal
  2. Run npm install -g @angular/cli

Hope that helps

1 Like

I tried to install the angular cli but it doesn’t look like working. Please check

Thanks for reporting this. It looks like there’s a bug in the PATH. Run export PATH=${PATH}:/home/codespace/.npm-global/bin and it will work.

You can also cause this to always execute by running the following:

echo 'export PATH=${PATH}:/home/codespace/.npm-global/bin' | tee -a ~/.bashrc >> ~/.zshrc

1 Like

This is fixed in this PR – it should be deployed to Codespaces over the next couple days: https://github.com/microsoft/vscode-dev-containers/pull/686

1 Like