angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.97k forks source link

Broccoli cannot find name 'module' #852

Closed vance closed 8 years ago

vance commented 8 years ago

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) OSX Capitan
  2. Versions. Please run ng --version. If there's nothing outputted, please
angular-cli: 0.0.39
node: 4.0.0
os: darwin x64
  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. create new app with cli then update ambientDeps to globalDeps in typings.json to work with 1.x typings typings install // that works ng serve // works
  2. The log given by the failure. Normally this include a stack trace and some more information.
Build error

The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: Typescript found the following errors:
  /Users/feldmanv/dev/ng2-play/ng2-tryout/tmp/broccoli_type_script_compiler-input_base_path-1UNmTC1e.tmp/0/src/app/ng2-tryout.component.ts (4, 13): Cannot find name 'module'.
    at BroccoliTypeScriptCompiler._doIncrementalBuild (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:115:19)
    at BroccoliTypeScriptCompiler.build (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10)
    at /Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
    at lib$rsvp$$internal$$tryCatch (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1198:9)
    at doNTCallback0 (node.js:407:9)
    at process._tickCallback (node.js:336:13)

The broccoli plugin was instantiated at: 
    at BroccoliTypeScriptCompiler.Plugin (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
    at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
    at BroccoliTypeScriptCompiler (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:27:10)
    at Angular2App._getTsTree (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/angular2-app.js:280:18)
    at Angular2App._buildTree (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/angular2-app.js:101:23)
    at new Angular2App (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/lib/broccoli/angular2-app.js:42:23)
    at module.exports (/Users/feldmanv/dev/ng2-play/ng2-tryout/angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:89:10)
    at new Class (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/lib/tasks/serve.js:15:19)
    at /Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/lib/commands/serve.js:64:24
    at lib$rsvp$$internal$$tryCatch (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/Users/feldmanv/dev/ng2-play/ng2-tryout/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
  1. Mention any other details that might be useful. brand new! failed :(
vance commented 8 years ago

i tried to use typings to search for angular2 related type definitions, but couldn't find them.

filipesilva commented 8 years ago

This was fixed in one of the more recent versions. If you re-make your project using beta.5 or above it should be fine.

prijindal commented 8 years ago

I am facing this same problem in a more recent version of cli angular-cli: 1.0.0-beta.9 node: 6.0.0 os: win32 x64

coxjonc commented 8 years ago

Yeah I'm also having the same problem in the current version of cli

angular-cli: 1.0.0-beta.9 node: 6.3.0 os: darwin x64

mrlund commented 8 years ago

Same here. Strange thing is I updated Angular to RC4 and the CLI to most recent a few days ago, and it's worked fine since. Just today it stopped working.

angular-cli: 1.0.0-beta.9 node: 4.4.5 os: win32 x64

mrlund commented 8 years ago

I have an update. I had removed the "Files" section from tsconfig.json in order to fix an issue where VS Code was marking squiggly lines on the component decorator which I thought might be because the files section limits the experimentalDecorators: true setting to those two.

 "files": [
    "main.ts",
    "typings.d.ts"
  ]

Typings.d.ts contains the declare statement for 'module', and re-adding the two entries enabled the build.

ghost commented 8 years ago

for atom-typescript :

"files": [
  "main.ts",
  "typings.d.ts"
],

for ng build :

"filesGlob": [
  "main.ts",
  "typings.d.ts"
]

I put them together.

"files": [
  "main.ts",
  "typings.d.ts"
],
"filesGlob": [
  "main.ts",
  "typings.d.ts",
  "app/**/*.ts"  
]

That works for me.

angular-automatic-lock-bot[bot] commented 5 years ago

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.