Error when creating a library. The "path" argument must be of type string.
carlosmoreira opened this issue · comments
Building entry point 'my-lib'
Compiling TypeScript sources through ngc
ERROR: The "path" argument must be of type string. Received type undefined
An unhandled exception occurred: The "path" argument must be of type string. Received type undefined
See "/private/var/folders/91/s_v05v41455dy0jy1zv8fjdc0000gp/T/ng-Y6r8Qy/angular-errors.log" for further details.
coreui-test$ cat /private/var/folders/91/s_v05v41455dy0jy1zv8fjdc0000gp/T/ng-Y6r8Qy/angular-errors.log
[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.dirname (path.js:1260:5)
at NgccProcessor.findNodeModulesDirectory (/Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ngc/ngcc-processor.js:79:21)
at new NgccProcessor (/Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ngc/ngcc-processor.js:16:43)
at /Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ng-package/entry-point/compile-ngc.transform.js:32:56
at Generator.next ()
at /Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ng-package/entry-point/compile-ngc.transform.js:8:71
at new Promise ()
at __awaiter (/Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ng-package/entry-point/compile-ngc.transform.js:4:12)
at exports.compileNgcTransform.transform_1.transformFromPromise (/Users/cmoreira/Documents/www/test/coreui-test/node_modules/ng-packagr/lib/ng-package/entry-point/compile-ngc.transform.js:21:75)
Steps:
- Fresh install of the template with "npm install".
- "ng generate library my-lib"
- "ng build my lib"
- Throws errors above
Angular CLI: 9.1.1
Node: 10.16.3
OS: darwin x64
Creating a library in a fresh Angular project has no issues. I am thinking it's a configuration in the angular.json, but cant seem to find anything.
Thoughts?
I hit the same issue - for me it was down to the "extends" property in tsconfig.lib.json - I had a different folder structure for projects and the library generated by ng had:
"extends": "../../../../tsconfig.json"
when the tsconfig it should inherit has only three levels up, so it should have been:
"extends": "../../../tsconfig.json"
Manually changing that fixed things for me.
For me helped to add baseUrl in tsConfig in root directory
"baseUrl": "./",
Maybe for somebody will help also
For me helped to add baseUrl in tsConfig in root directory
"baseUrl": "./",
Maybe for somebody will help also
I know its frowned upon on github to write gratitude messages, but oh boy, I've been fucking with this path argument error for a few days, and you just saved me. Thank you very much! Let the nine be with you, brave pilgrim 0_0
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions