ng: command not found – when install angular-cli on OSX

Angular2 requires a bunch of files to setup and things to configure. To avoid unnecessary typing and copying of files the angular guys created angular-cli which allows bootstrapping a new Angular2 application with just one line:

ng new my-fancy-app

When installing the angular-cli package using:

npm install -g angular-cli

I encountered a strange error message that stated:

ng: command not found

There is this discussion on Github but all comments there did not solve the issue for me. Finally I noticed that the ng-command is not linked in /usr/local/bin. The fix for my problem was to add it via:

ln -s /usr/local/Cellar/node/6.3.1/lib/node_modules/angular-cli/bin/ng /usr/local/bin/ng

Gulp build fails with: Error: Broken @import declaration of “”

I am currently working on a project that involves an Angular.js frontend and the build server running on a machine behind a corporate proxy. From time to time this error occurs:

Error: Broken @import declaration of “

All the other tasks such as bower install work fine because we set the proxy for bower, npm and git. After some research it became clear that the clean-css dependency that is used by gulp-minify-css  is the problem. This plugin ignores the proxy settings and tries to resolve the import declaration directly. Solution is very easy: just set a HTTP_PROXY environment variable with your proxy and everything works just fine.

This issue here describes some more possibilities to get around this problem.