angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Issues using Angular CLI for the first time

Open thorstenschaefer opened this issue 10 years ago • 5 comments

I'm new to Angular2 and wanted to try out the CLI tools, but unfortunately I had some issues setting it up. After installing CLI using npm, I received a warning on the console that the watcher is missing (this is not listed in the prerequisites). I installed it via homebrew according to http://ember-cli.com/user-guide/#watchman and the message went away.

Then I started creating a new project via "ng new" and the directory including its content was created without issues. However, after switching to the new directory and using "ng serve", I get an error: Could not require 'angular-cli-build.js': Cannot find module 'glob' Error: Could not require 'angular-cli-build.js': Cannot find module 'glob'

It seems that a javascript dependency is missing, but I'm not sure if this should be part of the CLI project or if I have to install it manually before using CLI somehow (if so, I'd expect it to appear in the prerequisites section).

I documented all the steps and the console output here: http://pastebin.com/dstXXCXR

Please let me know if there's other information you need to reproduce the issue.

My Setup:

  1. OS. Mac OSX El Capitan
  2. Versions. angular-cli: 0.0.33 node: 5.10.1 os: darwin x64
  3. Repro steps.
  4. The log given by the failure. Normally this include a stack trace and some more information.
  5. Mention any other details that might be useful. See http://pastebin.com/dstXXCXR

thorstenschaefer avatar Apr 20 '16 14:04 thorstenschaefer

@thorstenschaefer the watchman issue you can ignore, as ng-cli falls back to the default file watch system.

The issue you run into with ng serve is because there's a missing dependency glob. This is a know issue, and fixed in master. Will go out in the next release.

For now you can fix it by running:

npm install --save glob

Inside your project.

0x-r4bbit avatar Apr 20 '16 14:04 0x-r4bbit

/cc @Brocco

0x-r4bbit avatar Apr 20 '16 14:04 0x-r4bbit

Thanks Pascal, used your fix and ng serve is running now.

thorstenschaefer avatar Apr 20 '16 14:04 thorstenschaefer

@thorstenschaefer FYI the PR to fix this is already merged, it will be part of the next release (PR: #473)

In the meantime you can just install glob inside your project... npm i glob --save-dev

Brocco avatar Apr 20 '16 14:04 Brocco

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.