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

TypeError: Cannot read properties of undefined (reading 'split') #27736

Closed
1 of 4 tasks
ThePlenkov opened this issue Sep 3, 2024 · 2 comments · Fixed by #28761
Closed
1 of 4 tasks

TypeError: Cannot read properties of undefined (reading 'split') #27736

ThePlenkov opened this issue Sep 3, 2024 · 2 comments · Fixed by #28761

Comments

@ThePlenkov
Copy link
Contributor

Current Behavior

I try to build my package and get the error like this:

 npx nx build codegen
Convert compiler options from json failed, Cannot read file '/tsconfig.base.json'.

 NX   Cannot read properties of undefined (reading 'split')

Pass --verbose to see the stacktrace.

with verbose it looks like this:

 npx nx build codegen --verbose
Convert compiler options from json failed, Cannot read file '/tsconfig.base.json'.

 NX   Cannot read properties of undefined (reading 'split')


TypeError: Cannot read properties of undefined (reading 'split')
    at /workspace/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:256:58
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 1)
    at async buildProjectGraphAndSourceMapsWithoutDaemon (/workspace/node_modules/nx/src/project-graph/project-graph.js:80:31)
    at async createProjectGraphAndSourceMapsAsync (/workspace/node_modules/nx/src/project-graph/project-graph.js:208:25)
    at async createProjectGraphAsync (/workspace/node_modules/nx/src/project-graph/project-graph.js:198:39)
    at async Object.runOne (/workspace/node_modules/nx/src/command-line/run/run-one.js:24:26)
    at async handleErrors (/workspace/node_modules/nx/src/utils/params.js:22:24)
    at async Object.handler (/workspace/node_modules/nx/src/command-line/run/command-object.js:32:26)

Expected Behavior

I expect to see the real reason why my script has failed, but currently it fails just handling another errors

GitHub Repo

No response

Steps to Reproduce

I do not know how to reproduce, but there can be a chance when we have not an error, but an empty object in the following code contruction:

image

The error later happens in this code:

const innerStackTrace = ' ' + e.stack.split('\n').join('\n ');

Nx Report

nx report
Convert compiler options from json failed, Cannot read file '/tsconfig.base.json'.

 NX   Report complete - copy this into the issue template

Node           : 20.16.0
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 10.8.1

nx (global)        : 19.6.4
nx                 : 19.6.3
@nx/js             : 19.6.3
@nx/jest           : 19.6.3
@nx/linter         : 19.6.3
@nx/eslint         : 19.6.3
@nx/workspace      : 19.6.3
@nx/devkit         : 19.6.3
@nx/eslint-plugin  : 19.6.3
@nx/plugin         : 19.6.3
@nx/rollup         : 19.6.3
@nrwl/tao          : 19.6.3
@nx/vite           : 19.6.3
@nx/web            : 19.6.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
⚠️ Unable to construct project graph.
Cannot read properties of undefined (reading 'split')
TypeError: Cannot read properties of undefined (reading 'split')
    at /workspace/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:256:58
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 1)
    at async buildProjectGraphAndSourceMapsWithoutDaemon (/workspace/node_modules/nx/src/project-graph/project-graph.js:80:31)
    at async createProjectGraphAndSourceMapsAsync (/workspace/node_modules/nx/src/project-graph/project-graph.js:208:25)
    at async createProjectGraphAsync (/workspace/node_modules/nx/src/project-graph/project-graph.js:198:39)
    at async tryGetProjectGraph (/workspace/node_modules/nx/src/command-line/report/report.js:138:25)
    at async getReportData (/workspace/node_modules/nx/src/command-line/report/report.js:106:49)
    at async Object.reportHandler (/workspace/node_modules/nx/src/command-line/report/report.js:46:167)
    at async Object.handler (/workspace/node_modules/nx/src/command-line/report/command-object.js:8:9)

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@ThePlenkov
Copy link
Contributor Author

ThePlenkov commented Sep 3, 2024

BTW I managed to find the reason - I have created a root level tsconfig.json with following content:

{
    "extends": "../tsconfig.base.json",
    "compilerOptions": {
        "experimentalDecorators": true
    }
}

So it was pointing to not existing config and one of plugins was generating the exception error TS5083: Cannot read file '/tsconfig.base.json'. which has no stack, just symbol:
image

But it doesn't deny the fact that such errors must be properly handled by the framework

@mklueh
Copy link

mklueh commented Oct 8, 2024

This is the most annoying and verbose issue with Nx I've ever faced, because the sources can be several, but the information you get out of it is close to none

FrozenPandaz pushed a commit that referenced this issue Nov 6, 2024
…28761)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27736 and
#27736

(cherry picked from commit 906cc1a)
FrozenPandaz pushed a commit that referenced this issue Nov 12, 2024
…28761)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27736 and
#27736

(cherry picked from commit 906cc1a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants