Ionic本机Google地图:未找到Ionic-App-Scripts命令

时间:2018-10-02 13:29:41

标签: cordova ionic-framework ionic3 cordova-plugins

我正在尝试通过地图集成进行移动应用程序开发。我目前正在尝试使用以下方法: 节点 离子性 科尔多瓦 科尔多瓦Google Maps插件 Windows 10(内部版本1803)

在创建空白模板时,应用程序本身可以正确构建,并且可以正常加载。但是,当我向我的Google Maps插件添加引用时,会导致此错误:

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

       This package is required for this command to work properly.

? Install @ionic/app-scripts? Yes
> npm i -D -E @ionic/app-scripts
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @ionic/app-scripts@3.2.0
updated 1 package and audited 9232 packages in 21.358s

found 6 vulnerabilities (5 moderate, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
> ionic-app-scripts build
[08:15:08]  ionic-app-scripts 3.2.0
[08:15:08]  build dev started ...
[08:15:08]  clean started ...
[08:15:08]  clean finished in 3 ms
[08:15:08]  copy started ...
[08:15:08]  deeplinks started ...
[08:15:08]  deeplinks finished in 14 ms
[08:15:08]  transpile started ...
[08:15:14]  typescript: ...fors/ionic2-native-maps/node_modules/ionic-native/node_modules/rxjs/Subject.d.ts, line: 16
            Class 'Subject<T>' incorrectly extends base class 'Observable<T>'. Types of property 'lift' are
            incompatible. Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator:
            Operator<T, R>) => Observable<R>'. Type 'Observable<T>' is not assignable to type 'Observable<R>'. Type 'T'
            is not assignable to type 'R'.

      L16:  export declare class Subject<T> extends Observable<T> implements ISubscription {
      L17:      observers: Observer<T>[];

[08:15:14]  typescript: ...node_modules/ionic-native/node_modules/rxjs/observable/dom/WebSocketSubject.d.ts, line: 23
[08:15:14]  ionic-app-script task: "build"
[08:15:14]  Error: Failed to transpile program
Error: Failed to transpile program
    at new BuildError (C:\Users\Brett Lidfors\ionic2-native-maps\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at C:\Users\Brett Lidfors\ionic2-native-maps\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
    at new Promise (<anonymous>)
    at transpileWorker (C:\Users\Brett Lidfors\ionic2-native-maps\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
    at Object.transpile (C:\Users\Brett Lidfors\ionic2-native-maps\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
    at C:\Users\Brett Lidfors\ionic2-native-maps\node_modules\@ionic\app-scripts\dist\build.js:109:82
    at <anonymous>
            Class 'WebSocketSubject<T>' incorrectly extends base class 'AnonymousSubject<T>'. Types of property 'lift'
            are incompatible. Type '<R>(operator: Operator<T, R>) => WebSocketSubject<R>' is not assignable to type
            '<R>(operator: Operator<T, R>) => Observable<T>'. Type 'WebSocketSubject<R>' is not assignable to type
            'Observable<T>'. Types of property 'operator' are incompatible. Type 'Operator<any, R>' is not assignable to
            type 'Operator<any, T>'. Type 'R' is not assignable to type 'T'.

      L23:  export declare class WebSocketSubject<T> extends AnonymousSubject<T> {
      L24:      url: string;

[ERROR] ionic-app-scripts command not found.

我已经尝试过“删除模块并运行npm install,甚至尝试过在另一个项目中进行此操作。此组合是否存在任何已知问题,或者有人可以提供其他解决方案?我很乐意提供更多信息。

编辑: 这是我的package.json文件:

{
  "name": "ionic2-native-maps",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "^4.15.0",
    "@ionic-native/google-maps": "^4.14.0",
    "@ionic-native/splash-screen": "^4.15.0",
    "@ionic-native/status-bar": "~4.12.0",
    "@ionic/storage": "2.2.0",
    "@types/google-maps": "^3.2.0",
    "cordova-android": "7.1.1",
    "cordova-ios": "3.9.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-googlemaps": "2.4.6",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.1.4",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "ionic-angular": "3.9.2",
    "ionic-native": "^2.9.0",
    "ionicons": "3.0.0",
    "node-sass": "^4.9.3",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.0",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "MY KEY IS HERE",
        "API_KEY_FOR_IOS": "MY KEY IS HERE",
        "PLAY_SERVICES_VERSION": "15.0.1",
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      }
    },
    "platforms": [
      "android"
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

请使用以下命令:

<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css" rel="stylesheet" />
<div class="wrapper">
  <div id="grid" class="clickable" style="margin:100px 10px 20px 200px;"></div>
</div>

如果它不起作用,则需要在tsconfig.json文件中添加以下内容:

rm -rf node_modules package-lock.json npm install