Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
StephenFluin opened this issue Jun 15, 2018 · 5 comments · Fixed by #11261

Comments

@StephenFluin
Copy link
Contributor

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

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 15, 2018

@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.

@ParitoshikPaul
Copy link

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

#11377

Let me know if you need more details.

@jaq316
Copy link

jaq316 commented Nov 22, 2018

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

@AnthonyNahas
Copy link

@jaq316 thank you 👍

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants