jasonaden / angular-cli-lib-example

Example of making an Angular CLI project with a library distributed separate from the app.
65 stars 14 forks source link

BUILD ERROR : Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field #8

Open FernandaS opened 6 years ago

FernandaS commented 6 years ago

Getting Error Above when I run this command: npm run build:lib

dmanjava commented 6 years ago

Is there any progress on this? I get the same error.

markieshorty commented 6 years ago

Me too. Same error. Any progress?

ecingala commented 5 years ago

Hi, I tried to use this porject an I get the same error.

`C:\Data\development\Librairies\angular-cli-lib-example> C:\Data\development\Librairies\angular-cli-lib-example>npm run build:lib

angular-cli-lib-example@0.0.0 build:lib C:\Data\development\Librairies\angular-cli-lib-example ng-packagr -p libs/ngx-tabs-lib/package.json

Building Angular Package Building entry point 'ngx-tabs-lib' Compiling TypeScript sources through ngc

BUILD ERROR : Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.

Error: : Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.

at Object.<anonymous> (C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ngc\compile-source-files.js:53:68)
at Generator.next (<anonymous>)
at C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:28:32)
at Generator.next (<anonymous>)
at C:\Data\development\Librairies\angular-cli-lib-example\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>)

npm ERR! code ELIFECYCLE npm ERR! errno 111 npm ERR! angular-cli-lib-example@0.0.0 build:lib: ng-packagr -p libs/ngx-tabs-lib/package.json npm ERR! Exit status 111 npm ERR! npm ERR! Failed at the angular-cli-lib-example@0.0.0 build:lib script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\1373592\AppData\Roaming\npm-cache_logs\2018-10-30T10_59_21_742Z-debug.log

C:\Data\development\Librairies\angular-cli-lib-example>`

As extra information about my configuration, I give my angular version: C:\Data\development\Librairies\angular-cli-lib-example>ng -version Your global Angular CLI version (7.0.3) is greater than your local version (1.6.0). The local Angular CLI version is used.

When I use Yarn, I get the same error. For information the ng serve works fine.

Thank you for the explanation. Kind Regards.

Eddy

ecingala commented 5 years ago

This is the LOG file.

2018-10-30T10_59_21_742Z-debug.log

My NPM version is 5.10.0.

ecingala commented 5 years ago

By the way, if any of you found a solution, please, share it with us. My main purpose is the have an Angular Library that can be imported in another project. How did you solve this ?

gregorredinger commented 5 years ago

It seems like the error is caused by the newer versions of the ng-packagr library. I was able to solve it, by using the version 2.0.0-rc.0

You can install this version with npm install --save ng-packagr@2.0.0-rc.0

ng-packagr