angular / angular-cli

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

CLI beta.3 update and typings #176

Closed filipesilva closed 8 years ago

filipesilva commented 8 years ago

Updating the CLI to beta.2 and above at the moment requires typings for jasmine.

@hansl and I have been trying to add typings (https://github.com/angular/angular-cli/pull/175), but at the moment there are some issues.

broccoli-typescript seems to ignore type definitions so putting the typings directly on the src/ folder will not allow them to be compiled via ng serve.

On the other hand, putting them outside the src/ folder and referencing them also seems to have problems. Using the following reference /// <reference path="../../typings/main/ambient/jasmine/jasmine.d.ts" /> on src/app/new-project.spec.ts produces this error:

$ ng serve
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
[DiffingTSCompiler]: Typescript found the following errors:
  app/testproj.spec.ts (1, 1): File '../typings/main/ambient/jasmine/jasmine.d.ts' not found.
  app/testproj.spec.ts (10, 32): Property 'toBe' does not exist on type 'NgMatchers'.
  app/testproj.spec.ts (15, 35): Property 'toBe' does not exist on type 'NgMatchers'.
  app/testproj.spec.ts (16, 37): Property 'toBe' does not exist on type 'NgMatchers'.
  node_modules/angular2/src/testing/matchers.d.ts (4, 37): Cannot find namespace 'jasmine'.

(notice that it is trying to fetch the typing from the wrong folder)

So at the moment, using typings seems to break ng serve and without it we cannot upgrade to beta.2 and beyond.

/cc @IgorMinar

lianyi commented 8 years ago

Similar issue on beta3.


DiffingTSCompiler]: Typescript found the following errors:
  node_modules/angular2/src/testing/matchers.d.ts (4, 37): Cannot find namespace 'jasmine'.
Error: [DiffingTSCompiler]: Typescript found the following errors:
  node_modules/angular2/src/testing/matchers.d.ts (4, 37): Cannot find namespace 'jasmine'.
    at DiffingTSCompiler.doFullBuild (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:143:29)
    at DiffingTSCompiler.rebuild (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:72:18)
    at DiffingPluginWrapper.rebuild (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\angular-cli\lib\broccoli\diffing-broccoli-plugin.js:86:45)
    at C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\ember-cli\node_modules\broccoli\lib\api_compat.js:42:21
    at lib$rsvp$$internal$$tryCatch (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\rsvp\dist\rsvp.js:1048:17)
    at C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\rsvp\dist\rsvp.js:331:11
    at lib$rsvp$asap$$flush (C:\Users\hanl\Documents\WebStormProjects\angularjs-learning\angular2\angular2-target\node_modules\rsvp\dist\rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickCallback (node.js:348:13)
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
Brocco commented 8 years ago

Closing as the blueprints have been updated to beta 6 and typings are now working.

ghost commented 8 years ago

Did this ever get fixed or is the npm package outdated? I am getting some similar errors:

Error: Typescript found the following errors:
  /home/alex/WebstormProjects/SpeechAce/tmp/broccoli_type_script_compiler-input_base_path-JKPwQht6.tmp/0/src/client/app/speech-ace.spec.ts (8, 32): Property 'toBe' does not exist on type 'NgMatchers'.
  /home/alex/WebstormProjects/SpeechAce/tmp/broccoli_type_script_compiler-input_base_path-JKPwQht6.tmp/0/src/client/app/speech-ace.spec.ts (13, 35): Property 'toBe' does not exist on type 'NgMatchers'.
  /home/alex/WebstormProjects/SpeechAce/tmp/broccoli_type_script_compiler-input_base_path-JKPwQht6.tmp/0/src/client/app/speech-ace.spec.ts (14, 37): Property 'toBe' does not exist on type 'NgMatchers'.
  /home/alex/WebstormProjects/SpeechAce/tmp/broccoli_type_script_compiler-input_base_path-JKPwQht6.tmp/0/src/client/typings.d.ts (1, 1): File '/home/alex/WebstormProjects/SpeechAce/tmp/broccoli_type_script_compiler-input_base_path-JKPwQht6.tmp/0/typings/browser.d.ts' not found.
    at BroccoliTypeScriptCompiler._doIncrementalBuild (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:110:19)
    at BroccoliTypeScriptCompiler.build (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:44:10)
    at /home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
    at lib$rsvp$$internal$$tryCatch (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/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 BroccoliTypeScriptCompiler.Plugin (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
    at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
    at BroccoliTypeScriptCompiler (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:25:35)
    at Angular2App._getTsTree (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/lib/broccoli/angular2-app.js:255:18)
    at Angular2App.toTree (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/lib/broccoli/angular2-app.js:42:23)
    at module.exports (/home/alex/WebstormProjects/SpeechAce/angular-cli-build.js:9:14)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:89:10)
    at new Class (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/ember-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/home/alex/WebstormProjects/SpeechAce/node_modules/angular-cli/node_modules/ember-cli/lib/tasks/serve.js:15:19)
hansl commented 8 years ago

@runtheyards: You include the Jasmine typings twice somehow.

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.