当尝试在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.
SocialSharing和AppVersion已正确添加到项目中, 总是可以编译并确定,但是现在我遇到了这个错误。
问题是这是另外一件事吗?
有人可以帮助我吗?我需要解决这个问题。 谢谢!
答案 0 :(得分:2)
我也遇到了社交共享插件的循环依赖问题。我已经有一段时间没有使用插件了,看来@ionic-native/social-sharing
包现在可以导出类SocialSharingOriginal
而不是通常的SocialSharing
了。到目前为止,尚未找到任何突出强调重大变化的更改日志,这可能是Ionic 4
的原因。
到目前为止,一种解决方法是按以下方式导入SocialSharing
类。
import { SocialSharing} from '@ionic-native/social-sharing/ngx';
并且不要忘记将constructor
声明和app.module.ts
导入还原为SocialSharing
。
答案 1 :(得分:0)
似乎是语法错误。
您能检查一下是否是第52行的右括号。
Cannot find name 'SocialSharing'.
[14:05:33]: ▸ L50: public events: Events,
[14:05:33]: ▸ L51: private socialSharing: SocialSharing
[14:05:33]: ▸ L52: ) {
如果这不是问题,请告诉我,可能需要更多信息来了解问题。