Skip to content

error TS2304: Cannot find name 'LinearAccelerationSensor'.  #1

@ersaurabh101

Description

@ersaurabh101

I am trying to incorporate your tests in my app, but when i am trying to run it using ionic cordova run browser, your project runs absolutely fine but my project gives error

[ng] ERROR in src/app/devicemotion/devicemotion.page.ts:251:33 - error TS2304: Cannot find name 'LinearAccelerationSensor'.
[ng] 251       const accelerometer = new LinearAccelerationSensor();


my `ionic info` below, incase you need

Ionic:

   Ionic CLI                     : 5.4.13 (C:\Users\saurabh\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.0.1
   @angular-devkit/build-angular : 0.803.25
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.25
   @ionic/angular-toolkit        : 2.1.2

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 0.3.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\saurabh\AppData\Local\Android\Sdk)
   NodeJS            : v12.14.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.13.4
   OS                : Windows 10

Difference between ionic info of your project and mine, is this the reason for error ? see image below -
https://ibb.co/FhwYdZf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions