IONIC-Framework iOS构建失败 |社交分享 |应用



我在尝试在 Ionic pro 服务中构建 iOS 时遇到了这个问题。

这是输出:

[14:05:26]: ▸ > GlamitApp@0.0.1 build /builds/project-0
[14:05:26]: ▸ > ionic-app-scripts build --buildConfig=build.json
[14:05:28]: ▸ [14:05:28]  ionic-app-scripts 3.1.2 
[14:05:28]: ▸ [14:05:28]  build dev started ...
[14:05:28]: ▸ [14:05:28]  clean started ...
[14:05:28]: ▸ [14:05:28]  clean finished in 4 ms
[14:05:28]: ▸ [14:05:28]  copy started ...
[14:05:28]: ▸ [14:05:28]  deeplinks started ...
[14:05:28]: ▸ [14:05:28]  deeplinks finished in 229 ms
[14:05:28]: ▸ [14:05:28]  transpile started ...
[14:05:33]: ▸ [14:05:33]  typescript: src/app/app.component.ts, line: 51 
[14:05:33]: ▸ Cannot find name 'SocialSharing'.
[14:05:33]: ▸       L50:    public events: Events,
[14:05:33]: ▸       L51:    private socialSharing: SocialSharing
[14:05:33]: ▸       L52:  ) {
[14:05:33]: ▸ [14:05:33]  typescript: src/app/app.module.ts, line: 64 
[14:05:33]: ▸ Argument of type '{ declarations: (typeof ChatPage | typeof RatePage | typeof DetallePedidoPage | typeof
[14:05:33]: ▸ HistorialP...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are
[14:05:33]: ▸ incompatible. Type '(typeof SplashScreen | SocialSharingOriginal | typeof UserProvider | typeof InAppBrowser
[14:05:33]: ▸ | AppVer...' is not assignable to type 'Provider[]'. Type 'typeof SplashScreen | SocialSharingOriginal |
[14:05:33]: ▸ typeof UserProvider | typeof InAppBrowser | AppVers...' is not assignable to type 'Provider'. Type
[14:05:33]: ▸ 'SocialSharingOriginal' is not assignable to type 'Provider'. Type 'SocialSharingOriginal' is not assignable
[14:05:33]: ▸ to type 'ClassProvider'. Property 'provide' is missing in type 'SocialSharingOriginal'.
[14:05:33]: ▸       L64:  @NgModule({                                                                                                                                                
[14:05:33]: ▸       L65:    declarations: [
[14:05:33]: ▸ [14:05:33]  typescript: src/pages/login/login.ts, line: 41 
[14:05:33]: ▸ Cannot find name 'AppVersion'.
[14:05:33]: ▸       L40:  public events: Events,
[14:05:33]: ▸       L41:  private appVersion: AppVersion) {
[14:05:33]: ▸       L42:  localStorage.removeItem('access_token');
[14:05:33]: ▸ [14:05:33]  typescript: src/pages/my-profile/my-profile.ts, line: 30 
[14:05:33]: ▸ Cannot find name 'AppVersion'.
[14:05:33]: ▸       L29:  public platform: Platform,
[14:05:33]: ▸       L30:  private appVersion: AppVersion) {
[14:05:33]: ▸ [14:05:33]  ionic-app-script task: "build" 
[14:05:33]: ▸ [14:05:33]  Error: Failed to transpile program 
[14:05:33]: ▸ Error: Failed to transpile program
[14:05:33]: ▸     at new BuildError (/builds/project-0/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
[14:05:33]: ▸     at /builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
[14:05:33]: ▸     at new Promise ()
[14:05:33]: ▸     at transpileWorker (/builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
[14:05:33]: ▸     at Object.transpile (/builds/project-0/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
[14:05:33]: ▸     at /builds/project-0/node_modules/@ionic/app-scripts/dist/build.js:109:82
[14:05:33]: ▸     at 
[14:05:33]: ▸ npm ERR! code ELIFECYCLE
[14:05:33]: ▸ npm ERR! errno 1
[14:05:33]: ▸ npm ERR! GlamitApp@0.0.1 build: `ionic-app-scripts build --buildConfig=build.json`
[14:05:33]: ▸ npm ERR! Exit status 1
[14:05:33]: ▸ npm ERR!
[14:05:33]: ▸ npm ERR! Failed at the GlamitApp@0.0.1 build script.
[14:05:33]: ▸ npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

社交共享和App版本已正确添加到项目中,总是构建和编译正常,但现在我有这个错误。

问题是这个组件还是另一件事?

有人可以帮助我吗?我需要解决这个问题。谢谢!

我也面临着社交共享插件的循环依赖问题。我已经有一段时间没有使用过该插件了,似乎@ionic-native/social-sharing包现在导出类SocialSharingOriginal而不是通常的SocialSharing。到目前为止还没有找到任何突出显示重大更改的更改日志,这可能是为了Ionic 4.

到目前为止,解决方法是导入SocialSharing类,如下所示。

import { SocialSharing} from '@ionic-native/social-sharing/ngx';

并且不要忘记还原您的constructor声明并将导入app.module.ts SocialSharing

似乎是语法错误。

你能检查一下是第 52 行的右括号吗?

Cannot find name 'SocialSharing'.
[14:05:33]: ▸       L50:    public events: Events,
[14:05:33]: ▸       L51:    private socialSharing: SocialSharing
[14:05:33]: ▸       L52:  ) {

如果这不是问题,请告诉我,可能需要更多信息来了解问题。

最新更新