Cannot find module 'glob'

I had the same error on Windows 10,

D:\Code\AngularJS>ng new greetings-ac
Cannot find module 'glob'
Error: Cannot find module 'glob'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (D:\Code\node_modules\angular-cli\addon\ng2\tasks\lib-install.js:11:19)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

but the following fixed it:

D:\Code\AngularJS>npm install -g angcli

D:\Code\AngularJS>ng new greetings-ac
? Select project blueprint: Default template
Cloning into 'D:\Code\AngularJS\greetings-ac'...
install installing using npm
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN optional dep failed, continuing [email protected]
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN optional dep failed, continuing [email protected]

For now, run npm install --save glob in your project, or install globally npm install -g glob like Eric mentioned.

This is listed in Issue #233 on the angluar-cli project.

The missing glob dep has been fixed in latest master. This will go out in the next release. - posted 4/21/16

Versions ran with this fix:

  • angular-cli: 0.0.33
  • node: 5.9.1
  • glob: 7.0.3
  • angular2: 2.0.0-beta.14

There's already an issue reporting this error message. The workaround until the next release is to install glob for the project (npm install --save glob)

Regarding the commands, according to their repository under Generating and serving an Angular2 project via a development server the commands are as follow

ng new ponyracer : This command will create a project named ponyracer (a folder named ponyracer with all the set up in it).

ng serve : This command will run the live reload server to serve the application so you can see it in your browser.

PS : If you test the solution suggested in the issue it would be nice of you to report if it worked or not.

PS2 : I tested now (I fixed my error) and I cannot reproduce your error. I'm using node v5.5.0 and npm v3.7.3. Can you specify which node and npm versions are you using?