我已经浏览了互联网,但仍然找不到
在调试离子应用程序时出现错误
Waiting for the debugger to disconnect Syntax Error: Unexpected token *
类似于#613
我认为这是home.page.ts
home.page.ts
import { Component,ViewChild,ElementRef } from '@angular/core';
//set the type of google of google.maps.LatLNg
declare var google:any;
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
//catch id="map" in home.page.html
@ViewChild('map') mapRef:ElementRef;
constructor() {}
ionicViewDidLoad(){
this.showMap();
}
showMap(){
const location = new google.maps.LatLNg(51.507351,-0.127758);
//set the map
const options = {
center:location,
zoom:10
}
//show the map
const map = new google.maps.Map(this.mapRef.nativeElement,options)
this.addMarker(location,map);
}
//addMarker on google map
addMarker(position,map){
return new google.maps.Marker({
position,
map
})
}
}
这是我的package.json
package.json
{
"name": "ionic-maps",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"core-js": "^2.5.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.13.8",
"@angular-devkit/build-angular": "~0.13.8",
"@angular-devkit/core": "~7.3.8",
"@angular-devkit/schematics": "~7.3.8",
"@angular/cli": "~7.3.8",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.5.1",
"@ionic/lab": "2.0.5",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~12.0.0",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6"
},
"description": "An Ionic project"
}
p.s。地图元素的高度已设置为100%
它应该显示全屏的Google地图,但页面空白 但是,当我在Visual Studio中开始调试时,它会出现错误
C:\Program Files\nodejs\node.exe --inspect-brk=27765 dist\out-tsc\src\app\home\home.page.js
Debugger listening on ws://127.0.0.1:27765/c3a687c8-17ef-4c95-a58f-57d2b7d63499
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
c:\Users\User\for_ionic\ionic-maps\dist\out-tsc\src\app\home\home.page.js:1
import * as tslib_1 from "tslib";
^
SyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Waiting for the debuggeSyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
r to disconnect...