Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"export 'DOCUMENT' was not found in '@angular/platform-browser'

Happened while trying to upgrade IONIC app from version 3 to 4

Updated all plugins and modules to latest available, without any luck.

ERROR in ./node_modules/ionic-angular/components/app/app.js 24:35-43
"export 'DOCUMENT' was not found in '@angular/platform-browser'
ERROR in ./node_modules/ionic-angular/module.js 195:71-79
"export 'DOCUMENT' was not found in '@angular/platform-browser'
[ERROR] An error occurred while running subprocess ng.

This is my IONIC INFO

Ionic info:
Ionic:

   Ionic CLI                     : 5.1.0 (C:\Users\Acer\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.6.0
   @angular-devkit/build-angular : 0.800.6
   @angular-devkit/schematics    : 8.0.6
   @angular/cli                  : 8.0.6
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : 0.5.1
   native-run  : 0.2.6

System:

   Android SDK Tools : 26.1.1 (C:\Users\Acer\AppData\Local\Android\sdk)
   NodeJS            : v10.11.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.2
   OS                : Windows 10

would appreciate, somebody could be helpful.

like image 849
BanwariLal Bamalwa Avatar asked Jun 30 '19 17:06

BanwariLal Bamalwa


Video Answer


1 Answers

I faced this issue while migrating to angular 8.x.x .

Actually 'DOCUMENT' has been deprecated from '@angular/platform-browser' and is now part of '@angular/common'.

Older plugins still try to import document from '@angular/platform-browser' . Just check in the .js and .js.map files under 'fesm5' as well as 'fesm2015' folder of the plugin in node_modules section.

Better to update the specific plugin to latest angular compatible version.

In my case troubling plugin was 'ngx-clipboard'.

like image 183
Awanish Singh Avatar answered Sep 27 '22 19:09

Awanish Singh