Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
745 views
in Technique[技术] by (71.8m points)

cordova - "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:UsersAcerAppDataRoaming
pm
ode_modulesionic)
   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 (cordova-lib@9.0.1)
   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:UsersAcerAppDataLocalAndroidsdk)
   NodeJS            : v10.11.0 (C:Program Files
odejs
ode.exe)
   npm               : 6.9.2
   OS                : Windows 10

would appreciate, somebody could be helpful.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

DOCUMENT is removed from @angular/platform-browser If you use DOCUMENT from @angular/platform-browser, you should start to import this from @angular/common.

until the repo gets it fixed, you can do as below to fix it for you...

IN

ode_modulesionic-angularcomponentsappapp.js

Replace

import { DOCUMENT, Title } from '@angular/platform-browser';

with

import { DOCUMENT } from '@angular/common';
import { Title } from '@angular/platform-browser';

And IN

ode_modulesionic-angularmodule.js

Replace

import { DOCUMENT, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';

With

import { DOCUMENT } from '@angular/common';
import { HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...