Daniel Mizerski
Daniel Mizerski

Reputation: 1131

TypeScript errors while referencing Angular2 in Gulp

The problem is

[11:16:06] TypeScript: 103 semantic errors
[11:16:06] TypeScript: emit succeeded (with errors)

I am using node v5.7.0 and npm 3.6.0

gulp -v:

[11:26:58] Requiring external module babel-register
[11:26:58] CLI version 3.9.1
[11:26:58] Local version 3.9.1

I am total begginer with babel on gulp.

I generated the files under ubuntu 15.10 with yo 1.6.0 using generator-modern-web-dev in fresh folder.

The errors are like

app/test/sanity_test.spec.ts(2,1): error TS2304: Cannot find name 'describe'.
app/test/sanity_test.spec.ts(3,2): error TS2304: Cannot find name 'it'.
app/test/sanity_test.spec.ts(4,3): error TS2304: Cannot find name 'expect'.
app/test/sanity_test.spec.ts(7,2): error TS2304: Cannot find name 'xit'.
app/test/sanity_test.spec.ts(8,3): error TS2304: Cannot find name 'expect'.
/home/danielduel/Pulpit/server/node_modules/angular2/platform/browser.d.ts(77,90): error TS2304: Cannot find name 'Promise'.

then... more errors. (I can post it, if it is very critical to see all the 103 errors)

I was reinstaling sudo npm install npm_modules with success, but it was not fixed what I aam dealing with.

Then, task "scripts-javascript-dist" from

[11:16:09] 'scripts-javascript-dist' errored after 3.31 s
[11:16:09] Error: Error on fetch for npm:[email protected]/bootstrap.js at file:///home/danielduel/Pulpit/server/jspm_packages/npm/[email protected]/bootstrap.js

Can you lead me to fix this problems?

I can add source codes of tasks, but they are done over abstract ES2015 architecture and it depends on many files, but if its needed - give me the info.

StackOverflow threads that I was trying and looks at least fammiliar:

  1. module not found angular, generates more errors
  2. this one looks good, but I do not understand at all
  3. this one, with config is not working as fix, generates more errors

I think, I am missing something, but I can't recognize what.

Upvotes: 0

Views: 1047

Answers (1)

Andreas Jägle
Andreas Jägle

Reputation: 12240

You should never need to sudo npm install locally!

From the errors you presented, it looks to me as if the project doesn't have all required type definitions, especially these for the test code. This could be caused by some invalid project setup or by incorrect references inside the included modules.

Please check if you have tsd or typings in your project and install the missing type definitions for (I assume) jasmine.

https://github.com/typings/typings (new)

http://definitelytyped.org/tsd/ (deprecated)

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jasmine/jasmine.d.ts

It's hard to say if this is the solution in your case, but I hope this helps you tracking down the root cause.

Upvotes: 1

Related Questions