Angular-cli: Building library gives error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

Created on 15 Jun 2018  路  5Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

This bug has hit me a few times during live demos.

Area

Unsure of source, problem exhibits in CLI.

Versions

CLI starts on 1.x but moves to 6.x.

/home/stephen/.angular-config.json:

{
  "version": 1,
  "cli": {
    "packageManager": "yarn"
  }
}

Repro steps

(use Yarn by default globally)
yarn global add @angular/cli@^1.0.0
ng new my-app
cd my-app
yarn add @angular/angular-cli
ng update @angular/angular-cli
ng update @angular/core
ng generate library my-shared-lib
ng build --project=my-shared-lib

The log given by the failure

$ ng build --project=my-shared-lib
Building Angular Package
Building entry point 'my-shared-lib'
Rendering Stylesheets
Rendering Templates
Compiling TypeScript sources through ngc

BUILD ERROR
error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

Error: error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

    at Object.<anonymous> (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:53:68)
    at Generator.next (<anonymous>)
    at /super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:3:12)
    at Object.compileSourceFiles (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:19:12)
    at Object.<anonymous> (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:26:32)
    at Generator.next (<anonymous>)
    at /super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:7:71
    at new Promise (<anonymous>)

error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

Error: error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

    at Object.<anonymous> (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:53:68)
    at Generator.next (<anonymous>)
    at /super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:3:12)
    at Object.compileSourceFiles (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ngc/compile-source-files.js:19:12)
    at Object.<anonymous> (/super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:26:32)
    at Generator.next (<anonymous>)
    at /super/workspace/test/update-library-test/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:7:71
    at new Promise (<anonymous>)

Desired functionality

I'd like to see my library built by the CLI

Most helpful comment

I fixed the issue by adding "baseUrl": "./" to the "compilerOptions" of tsconfig.json

All 5 comments

@StephenFluin, the problem is that in Angular CLI 1.X.X the root tsconfig didn't have baseUrl, and when upgrading to v6 the baseUrl option is not added. baseUrl is now mandatory especially when creating a library.

@alan-agius4 : This is the issue when I am building my project inside my workspace.

https://github.com/angular/angular-cli/issues/11377

Let me know if you need more details.

I fixed the issue by adding "baseUrl": "./" to the "compilerOptions" of tsconfig.json

@jaq316 thank you 馃憤

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings