简体   繁体   中英

Error: Failed to transpile program ionic2

ionic cordova build android [WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:

       npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-a

[INFO] Running app-scripts build: --platform android --target cordova

[15:38:32]  build dev started ...
[15:38:32]  clean started ...
[15:38:32]  clean finished in 1 ms
[15:38:32]  copy started ...
[15:38:32]  transpile started ...
[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 6
            Cannot find name 'describe'.

       L5:  beforeEach(() => {
       L6:    TestBed.configureTestingModule({
       L7:      declarations: [

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 7
            Cannot find name 'beforeEach'.

       L6:  TestBed.configureTestingModule({
       L7:    declarations: [
       L8:      AppComponent

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 16
            Cannot find name 'it'.

      L15:  const fixture = TestBed.createComponent(AppComponent);
      L16:  const app = fixture.debugElement.componentInstance;
      L17:  expect(app).toBeTruthy();

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 19
            Cannot find name 'expect'.

      L18:    }));
      L20:    it(`should have as title 'app works!'`, async(() => {

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 22
            Cannot find name 'it'.

      L21:  const fixture = TestBed.createComponent(AppComponent);
      L22:  const app = fixture.debugElement.componentInstance;
      L23:  expect(app.title).toEqual('app works!');

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 25
            Cannot find name 'expect'.

      L24:    }));
      L26:    it('should render title in a h1 tag', async(() => {

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 28
            Cannot find name 'it'.

      L27:  const fixture = TestBed.createComponent(AppComponent);
      L28:  fixture.detectChanges();
      L29:  const compiled = fixture.debugElement.nativeElement;

[15:38:39]  typescript: C:/Users/NATALIA/Pictures/mdp365-ionic3/src/aponent.spec.ts, line: 32
            Cannot find name 'expect'.

      L31:    }));
      L32:  });

Error: Failed to transpile program at BuildError.Error (native) at new BuildError (C:\\Users\\NATALIA\\Pictures\\mdp365-ionic3\\node_moic\\app-scripts\\dist\\util\\errors.js:16:28) at C:\\Users\\NATALIA\\Pictures\\mdp365-ionic3\\node_modules\\@ionic\\appist\\transpile.js:137:20 at transpileWorker (C:\\Users\\NATALIA\\Pictures\\mdp365-ionic3\\node_mnic\\app-scripts\\dist\\transpile.js:103:12) at Object.transpile (C:\\Users\\NATALIA\\Pictures\\mdp365-ionic3\\node_onic\\app-scripts\\dist\\transpile.js:61:12) at buildProject (C:\\Usersenter code here\\NATALIA\\Pictures\\mdp365-ionic3\\node_modu\\app-scripts\\dist\\build.js:97:78) at C:\\Users\\NATALIA\\Pictures\\mdp365-ionic3\\node_modules\\@ionic\\appist\\build.js:47:16

All of the missing members look related to your test framework (I'm guessing it is Jasmine or Jest):

Cannot find name 'describe'.
...
Cannot find name 'it'.

You need to ensure that:

  1. you have the framework available (in your package.json , etc)
  2. have imported the framework in your spec file (import/require etc)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM