建设IONIC 3项目无法正常工作

时间:2017-12-16 13:41:01

标签: json angular typescript ionic-framework ionic3

  ng build --prod
    Date: 2017-12-16T12:11:38.469Z
    Hash: 9af9d0824b91129853ac
    Time: 3766ms
    chunk {0}  (styles) [initial] [rendered]
    chunk {1} polyfills.bf31271ed8358d9c1c6b.bundle.js (polyfills) 155 bytes [initial] [rendered]
    chunk {2} main.a0f3445c4f3c97baab24.bundle.js (main) 149 bytes [initial] [rendered]
    chunk {3} inline.c30c9795283a00740af2.bundle.js (inline) 1.45 kB [entry] [rendered]

    ERROR in multi ./src/main.ts
    Module not found: Error: Can't resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/c
    li/models/webpack-configs'
    resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/models/webpack-configs'
      using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
        Field 'browser' doesn't contain a valid alias configuration

      after using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
        using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/package.json (relative path: ./src/main.ts)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts doesn't exist
          .ts
            Field 'browser' doesn't contain a valid alias configuration
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts.ts doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts.js doesn't exist
          as directory
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts doesn't exist
    [/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts]
    [/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts.ts]
    [/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts.js]
    [/Users/tyyiu/Documents/Code/IONIC/quorra/src/main.ts]
     @ multi ./src/main.ts
    ERROR in multi ./src/polyfills.ts
    Module not found: Error: Can't resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angu
    lar/cli/models/webpack-configs'
    resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/models/webpack-configs'
      using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
        Field 'browser' doesn't contain a valid alias configuration
      after using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
        using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/package.json (relative path: ./src/polyfills.ts)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts doesn't exist
          .ts
            Field 'browser' doesn't contain a valid alias configuration
            /Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts.ts doesn't exist
 .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts.js doesn't exist
      as directory
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts doesn't exist
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts.ts]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts.js]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/polyfills.ts]
 @ multi ./src/polyfills.ts

ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angula
r/cli/models/webpack-configs'
resolve '/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css' in '/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/models/webpack-configs'
  using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@angular/cli/package.json (relative path: ./models/webpack-configs)
    using description file: /Users/tyyiu/Documents/Code/IONIC/quorra/package.json (relative path: ./src/styles.css)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css.js doesn't exist
      as directory
        /Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css doesn't exist
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css.ts]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css.js]
[/Users/tyyiu/Documents/Code/IONIC/quorra/src/styles.css]
 @ multi ./src/styles.css
ERROR in TypeError: Cannot read property 'length' of undefined
    at createSourceFile (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/typescript/lib/typescript.js:16640:109)
    at parseSourceFileWorker (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/typescript/lib/typescript.js:16572:26)
    at Object.parseSourceFile (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/typescript/lib/typescript.js:16521:26)
    at Object.createSourceFile (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/typescript/lib/typescript.js:16371:29)
    at new TypeScriptFileRefactor (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@ngtools/webpack/src/refactor.js:79:35)
    at Object.resolveEntryModuleFromMain (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@ngtools/webpack/src/entry_resolver.js:108:20)
    at Promise.resolve.then.then (/Users/tyyiu/Documents/Code/IONIC/quorra/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:240:54)

文件树: src/tsconfig.json; src/app; src/pages - >我将tsconfig.json放入src文件夹中,否则会出现错误,表示无法找到它。

我想知道错误导致的位置和原因。如果是因为我将tsconfig.json放在src/文件夹中,那么为什么找不到文件的错误,即使它就在那里呢?

我的tsconfig.json仅来自:https://github.com/kristofferandreasen/simple-ionic-3-app/blob/master/tsconfig.json

2 个答案:

答案 0 :(得分:0)

这就是你如何构建一个角度项目而不是离子项目。方法如下,您可以选择以下命令之一:

$ ionic build
$ ionic cordova build ios
$ ionic cordova build ios --prod --release
$ ionic cordova build ios --device --prod --release -- --developmentTeam="ABCD" --codeSignIdentity="iPhone Developer" --packageType="app-store"
$ ionic cordova build android
$ ionic cordova build android --prod --release -- -- --keystore=filename.keystore --alias=myalias
$ ionic cordova build android --prod --release -- -- --minSdkVersion=21
$ ionic cordova build android --prod --release -- -- --versionCode=55

但是从我看到你可能需要$ ionic build

答案 1 :(得分:0)

首次运行

npm i

然后运行以下命令

ionic cordova build --release android --prod