We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Angular-CLI Cannot find name 'ej'

I have created new application using angular CLI as Abinaya Subbiah described here: https://www.syncfusion.com/forums/127630/how-to-work-with-angular-cli
I have typings installed in my package.json:
"devDependencies: {
...
"@types/ej.web.all": "^15.1.4" //I have tried version "^0.0.1" - didn't help
}

I try to use "ej" namespace to configure my ej-grid (ej.Grid.SummaryType.Sum)

When I try to start my application it throws an error "Cannot find name 'ej'".

How should I install typings for my Angular CLI appliacion?

12 Replies

MS Mani Sankar Durai Syncfusion Team April 24, 2017 12:35 PM UTC

 
Hi mujef, 
 
                                                               
Thanks for contacting Syncfusion support. 
 
 
We suspect that the issue occurred due to typings not installed properly in the sample. In some system environment typings will not be installed properly, so please ensure typings are installed properly in the application as like the below screenshot.  
   
       
  
  • To install Syncfusion JavaScript and Angular 2 components run below commands from sample’s root folder. 
   
npm install --save-dev @types/ej.web.all   
   
    
·         Now the typings will be installed properly.    
 
If you still face the issue please get back to us with the following details. 
1.       Share the screenshot/video of the issue that you have faced 
2.       If possible share the sample with issue reproducing. 
 
The provided information will help us to analyze the issue and provide you the response as early as possible. 
  
Please let us know if you need further assistance 

Regards, 
Manisankar Durai. 



MU mujef April 24, 2017 12:44 PM UTC

I have ej.web.all typings in node_modules folder - exactly like on your screenshot.
npm install command didn't help.
When I try to start my appliaction angular cli shows "Cannot find name 'ej'" in file where I use it.
The same error is displayed in the browser when I open my application address.


MU mujef April 24, 2017 02:24 PM UTC

To reproduce the issue:
1) create new app as described On March 8, 2017 01:37 AM in https://www.syncfusion.com/forums/127630/how-to-work-with-angular-cli
2) in app.component.ts create
test () {
   const a = ej.DataManager;
}
3) run ng serve --aot false


MS Mani Sankar Durai Syncfusion Team April 25, 2017 01:29 PM UTC

Hi mujef, 

We have analyzed your query and we are able to reproduce the reported issue. We suspect that the ej.web.all in types will be referred before the jquery rendered in tsconfig.app. So this issue occurs. To avoid this we suggest you to change the ej.web.all after the jquery renders in your tsconfig.app file. 
Note: tsconfig.app JSON file will be located in src folder of your project file. 

Refer the code example. 
[tsconfig.app] 
 
{ 
  "compilerOptions": { 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ 
      "es2016", 
      "dom" 
    ], 
    "outDir": "../out-tsc/app", 
    "target": "es5", 
    "module": "es2015", 
    "baseUrl": "", 
    "typeRoots": [ 
      "node_modules/@types/" 
    ], 
    "types": [ 
      "jquery", 
      "ej.web.all", 
      "node", 
      "es6-shim" 
    ] 
  }, 
  "exclude": [ 
    "test.ts", 
    "**/*.spec.ts" 
  ] 
} 
 


We have also prepared a sample that can be downloaded from the below link 

If you still face the issue please share us the following details. 
1.       Share the code example. 
2.       Share the screenshot of the issue with stack trace 
3.       If possible share the sample with issue reproducing. 
The provided information will help us to analyze the requirement and provide you the response as early as possible. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 



FL Flavio October 27, 2017 12:50 PM UTC

I have the same problem here, Im just trying the Schedule component.

I have installed and configured everything, that is working fine, but when I use "ej." it throw an error.




MS Mani Sankar Durai Syncfusion Team October 30, 2017 12:51 PM UTC

Hi Flavio, 


A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.   
 
 
 
Regards,   
Manisankar Durai 
 



CR Christopher Römer November 14, 2017 09:38 AM UTC

Hi Mani Sankar Durai,


any updates on this topic?

Experiencing the same problem, source code is working, but ej. throws an error and no code-completion/suggestion is working, which is unfortune!


Glad to hear from you,

regards Christopher



MS Mani Sankar Durai Syncfusion Team November 15, 2017 10:25 AM UTC

Hi Christopher, 


  • Run the below command to install typing file ej.web.all
    
npm install @types/ej.web.all --save-dev  
    
     
·       Now the typings will be installed properly.  
 
Kindly try the sample and if the issue persists, try to reproduce the error in a sample and revert it back to us. Or else you can share your code example (ts and html file)/runnable sample (if possible) to proceed further.    

Regards, 
Manisankar Durai. 



CR Christopher Römer November 15, 2017 01:01 PM UTC

Hi Manisankar,

the problem still persists. 
I took your example, did the steps you wrote and just wanted to implement a ej.DataManager with connection to a OData-Service.

Regards Christopher

Attachment: angularcli_still_not_found_1a9da08a.zip


MS Mani Sankar Durai Syncfusion Team November 16, 2017 02:49 PM UTC

Hi Christopher,   
  
You have missed to include new keyword in front of the DataManager, hence the error. Kindly refer to the following code snippet.   
  
[app.component.ts]   
this.dataManger = new ej.DataManager({    
    url: "http://localhost:2088/api"// web api url    
    crossDomain: true,     
    adaptor: new ej.WebApiAdaptor()  });    
   
Regards,   
Manisankar Durai. 
 



RU Ruben January 23, 2018 12:21 PM UTC

Hi! I am also encountering the same problem: "error TS2304: Cannot find name 'ej'".
I am using Rider IDE on Linux. I can run the Angular app, the IDE recognizes the ej(when i click on "go to source code"), but when it comes to testing the angular app, Karma yields that it does not recognize it. 

I have to mention that when I try to run the command ''npm install --save-dev @types/ej.web.all", I get these 'errors':
...-client@1.0.0 /home/ruben-grab/Work/.../.../src/....../Client/... // just the path to my Angular application.
├── UNMET PEER DEPENDENCY @angular/animations@5.1.3
├── UNMET PEER DEPENDENCY @angular/compiler@5.2.1
├── UNMET PEER DEPENDENCY @angular/core@5.2.1
├── @types/ej.web.all@15.4.2 
└── UNMET PEER DEPENDENCY tslint@5.8.0

The thing is, I have installed all those modules, but just a slightly lower version
Could you point me in the right direction? I am not using Karma right? I do not installed the typings the right way? 
 Thank you for your time!



SS Subha Shree Ramanathan Syncfusion Team January 24, 2018 02:41 PM UTC

Hi Ruben, 

The issue “Cannot find name ‘ej’” is occurred due to our typings @types/ej.web.all is not installed properly. So we suggest you to install the typings NPM package @types/ej.web.all properly. 

Query: I try to run the command ''npm install --save-dev @types/ej.web.all", I get these 'errors': 
 
We have tried out a sample with the given versions of Angular packages which does not throws any error. Refer to the below screenshot for installation of our typings. 
 
 

For your convenience we have prepared a sample with Karma configuration and attached below.  


We documented the steps to integrate our Angular components in Karma and Jasmine and attached below. 


If you are still facing any issues, please share the below information with us. 

  • IDE specification (version)
  • Node and NPM Version
  • Modify the attached sample to reproduce the issue

Please let us know if you need further assistance on this. 

Thanks, 
Subha Shree D.R 


Loader.
Up arrow icon