surveyjs / surveyjs_angular_cli

SurveyJS + Angular CLI Quickstart Template
http://surveyjs.io/
41 stars 52 forks source link

after install when run show this error #2

Closed wohugb closed 6 years ago

wohugb commented 7 years ago
[at-loader] Checking finished with 5 errors
[at-loader] node_modules/surveyjs-editor/surveyeditor.d.ts:74:17
    TS2304: Cannot find name 'KnockoutObservable'.
tsv2013 commented 7 years ago

I have cloned this repo in a new folder: git clone https://github.com/surveyjs/surveyjs_angular_cli.git run npm i and then npm start and it works for me on "http://localhost:4200/".

What are your steps to reproduce the issue?

starday commented 7 years ago

node_modules/surveyjs-editor/surveyeditor.d.ts (141,18): Cannot find name 'KnockoutObservable'. what could be wrong?

tsv2013 commented 7 years ago

@starday Do you have the "surveyjs_angular_cli\node_modules\@types\knockout\" folder afer "npm i" command? If no, you can install it vua "npm i @types/knockout" command.

starday commented 7 years ago

@tsv2013 thanks for your response for still have the issue after running npm install @types/knockout

tsv2013 commented 7 years ago

@starday Can you try npm i @types/knockout?

tsv2013 commented 7 years ago

@starday Do you have the "surveyjs_angular_cli\node_modules\@types\knockout" folder afer "npm i" command?

starday commented 7 years ago

@tsv2013 yes i do have \node_modules@types\knockout. I don't know if it could be because am running it against angular 4 app.

tsv2013 commented 7 years ago

@starday I have @angular/cli@1.0.0 installed globally. And "version": "4.1.2" of "name": "@angular/core" package.

rjcorwin commented 7 years ago

This looks like a problem purely with the surveyjs-editor package. All you have to do is include it and it tries to use some exported classes from its survey-knockout package dependency that this dependency doesn't actual declare or export.

VSCode warning us there is nothing named KnockoutObservable.

screen shot 2017-05-22 at 7 15 52 am

Confirming there is nothing called KnockoutObservable in the survey-knockout package.

screen shot 2017-05-22 at 7 23 33 am
rjcorwin commented 7 years ago

Looking through the commits on this repository I see that knockout needs to be added to the the types array in app/tsconfig.app.ts.

screen shot 2017-05-22 at 7 44 43 am

That was my missing step as I'm building this from scratch and that direction is not in the README.

tsv2013 commented 7 years ago

@rjsteinert Yes, I've missed this step in the README. Thank you for your help! I'll update the README. I 'd like to ask you - what is if you just clone this repo and run npm start after npm i? Because I tried exact this scenario and have not managed to reproduce the compilation error.

tsv2013 commented 7 years ago

@rjsteinert I've updated README. Thank you again.

meetgaurang commented 6 years ago

Thanks @rjsteinert!

ashygk commented 6 years ago

Having this error on survey.angular.d.ts. I have added types: knockout to tsconfig.app.json

ERROR in node_modules/survey-angular/survey.angular.d.ts(606,14): error TS2304: Cannot find name 'KnockoutObservable'. node_modules/survey-angular/survey.angular.d.ts(607,17): error TS2304: Cannot find name 'KnockoutComputed'. node_modules/survey-angular/survey.angular.d.ts(608,13): error TS2304: Cannot find name 'KnockoutComputed'. node_modules/survey-angular/survey.angular.d.ts(609,19): error TS2304: Cannot find name 'KnockoutObservable'.

edwinborda commented 6 years ago

In src/polyfills.ts add

import * as ko from 'knockout'; window['knockout'] = ko;

I worked for me.