angular-cli: Unable to build on Docker Linux Image (ubuntu)

angular-cli: 1.0.0-beta.5
node: 5.10.1
os: linux x64
(More specifically running in a docker container Linux 4.4.8-boot2docker #1 SMP Mon Apr 25 21:57:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux)

No code changes simply ran the following commands

ng new testapp
cd app testapp
ng build

Keep on getting the following error: Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info. Build failed. The Broccoli Plugin: [Funnel] failed with: Error: ENOENT: no such file or directory, lstat ‘typings’ at Error (native) at Object.fs.lstatSync (fs.js:887:18) at symlink (/testapp/node_modules/angular-cli/node_modules/symlink-or-copy/index.js:60:26) at symlinkOrCopySync (/testapp/node_modules/angular-cli/node_modules/symlink-or-copy/index.js:55:5) at /testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/read_compat.js:58:9 at lib$rsvp$$internal$$tryCatch (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1048:17) at lib$rsvp$$internal$$publish (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1019:11) at lib$rsvp$asap$$flush (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

The broccoli plugin was instantiated at: at Funnel.Plugin (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/index.js:7:31) at new Funnel (/testapp/node_modules/angular-cli/node_modules/broccoli-funnel/index.js:44:10) at Angular2App._buildInputTree (/testapp/node_modules/angular-cli/lib/broccoli/angular2-app.js:85:7) at new Angular2App (/testapp/node_modules/angular-cli/lib/broccoli/angular2-app.js:51:41) at module.exports (/testapp/angular-cli-build.js:6:10) at Class.module.exports.Task.extend.setupBroccoliBuilder (/testapp/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19) at Class.module.exports.Task.extend.init (/testapp/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10) at new Class (/testapp/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12) at Class.module.exports.Task.extend.run (/testapp/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19) at /testapp/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24 at lib$rsvp$$internal$$tryCatch (/testapp/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/testapp/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17) at /testapp/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11 at lib$rsvp$asap$$flush (/testapp/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

Update: The issue seems specific to linux (ubuntu). Running the same commands on OS X builds the app successfully

Here are the mac configurations. Is there a reason why its not building on linux?

angular-cli: 1.0.0-beta.5
node: 5.5.0
os: darwin x64
ng build
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Built project successfully. Stored in "dist/".

Update 2:

Upon further investigation, it seems like ng new on linux does not install typings correctly and for some reason those dependences are not pulled even when manually trying to install them

On OSX the typings dir typings ├── browser │   └── ambient │   ├── angular-protractor │   │   └── index.d.ts │   ├── es6-shim │   │   └── index.d.ts │   ├── jasmine │   │   └── index.d.ts │   └── selenium-webdriver │   └── index.d.ts ├── browser.d.ts ├── main │   └── ambient │   ├── angular-protractor │   │   └── index.d.ts │   ├── es6-shim │   │   └── index.d.ts │   ├── jasmine │   │   └── index.d.ts │   └── selenium-webdriver │   └── index.d.ts └── main.d.ts

On Linux (after manually invoking typings install) the typings directory is not created by ng new typings `-- index.d.ts

The content of typings.json are identical on both OS

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I think I know what’s going on. The CLI is still using the pre 1.0 typings version, but you must have the most recent version installed.

Can you do the following from your project root and show me the results?

rm -rf typings
npm run postinstall
ng serve

Ubuntu 16.04, OSX,& Angular-CLI Watchman & Broccoli Errors Bug / Fix

Hello everyone, I have had all the same errors above this thread and this fix for fb-watchman aka watchman seems to be the heart of the problem. I am not sure why this happens via Linux & OSX only, but there are many version of the same problem I feel. I hope this helps resolve many of the issues Linux Ubuntu and OSX has been having. It surely cleared everything up for me. If you try and install watchman globally via NPM, this file is not the same. Source here: http://ember-cli.com/user-guide/#watchman

For Ubuntu version 16.04, it seems we need to manually install watchman via source code. This will enable our material & angular 2 environment to work without any watch related errors. At the moment, my angular-cli build works and launches the server saying hello, but the watchman still errors out and fails to load. It took a couple hours to do some dirty work, but I have traced out the errors each step of the way by trial and error.

The angular-cli system now works with with Linux / Ubuntu 16.04 and possibly also 14.0 may need to do this fix from @yahyaKacem experience. This should also ‘help’ OSX users.

The Error:

‘$ ng serve`(node:2406) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info.
Livereload server on http://localhost:49152
Serving on http://localhost:4200/

_https://facebook.github.io/watchman/docs/install.html#installing-from-source_

Information:

You can use these steps below to get watchman built. You will need autoconf and automake. For python support, you will also need setuptools and may need to install a python-dev or python-devel package.

$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.5.0 # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Download each git repository for dependencies

Install each separate m4, autoconf, & automake via extracted directory.

  1. ./configure
  2. make
  3. sudo make install

##Serve the Angular CLI via ng serve ng serve

Install via Ubuntu python-dev

sudo apt-get install python-dev

Possible Errors / Fixes:

‘The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl’

“A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1464729822: inotify-add-watch(/home/jix/Desktop/Project Development/Angular Material Demo/material-project/node_modules/angular-cli/node_modules/angular-cli/node_modules/markdown-it-terminal/node_modules/markdown-it/lib/common) -> *The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl* All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at *https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch*”

_https://facebook.github.io/watchman/docs/install.html#linux-inotify-limits_

  • /proc/sys/fs/inotify/max_user_instances impacts how many different root dirs you can watch.
  • /proc/sys/fs/inotify/max_user_watches impacts how many dirs you can watch across all watched roots.
  • /proc/sys/fs/inotify/max_queued_events impacts how likely it is that your system will experience a notification overflow.

To update / change the default configurations, do the following commands:

_Source: http://unix.stackexchange.com/questions/13751/kernel-inotify-watch-limit-reached#13757_

Step 1: (check current status of inotify watches, instances, & events)

  1. cat /proc/sys/fs/inotify/max_user_watches
  2. cat /proc/sys/fs/inotify/max_user_instances
  3. cat /proc/sys/fs/inotify/max_queued_events

Step 2: (change current status of inotify watches, instances, & events for Ubuntu)

  1. echo 10485760 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
  2. echo 10485760 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
  3. echo 10485760 | sudo tee -a /proc/sys/fs/inotify/max_queued_events

Conclusion:

This has fixed all errors encountered with the fb-watchman aka ‘watchman’ for Ubuntu 16.04 & angular-cli. The NPM ‘watchman’ is not the same file. I assume this needs to be accomplished on v14 too, but let me know if this helps.

Peace bug-ubuntu16 04_angularcli_watchmanerrors_fix

you have no typings installed. typings install before you run ng build. post-install didnt do it for you because you either don’t have typings installed globally or something else.