question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read properties of undefined (reading 'cwd')

See original GitHub issue

All of a sudden I am seeing the following error (was building fine yesterday):

TypeError: Cannot read properties of undefined (reading 'cwd')

Have tried:

  • Updating content layer (0.2.4)
  • Updating Next (12.1.5)
  • Node 16.13
  • Node 16.14
  • Node 17.9

Cannot get any combination of the above to resolve the issue.

Other things I have tried:

  • Nuking the node_modules/ and .contentlayer directory as well.
  • Nuking the entire project, re-cloning, re-installing deps.

Full error:

TypeError: Cannot read properties of undefined (reading 'cwd')
  at f (file:///website/node_modules/@contentlayer/source-files/node_modules/@contentlayer/core/src/cwd.ts:24:53)
  at f (file:///website/node_modules/@effect-ts/system/_src/Effect/has.ts:121:43)
  at IRead.f (file:///website/node_modules/@effect-ts/system/_src/Effect/has.ts:113:33)
  at FiberContext.evaluateNow (file:///website/node_modules/@effect-ts/system/_src/Fiber/context.ts:1136:31)
  at file:///website/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
  at file:///website/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9

Fiber: #17 (started at: 2022-05-10T06:02:17.445Z) was supposed to continue to:

a future continuation at packages/@contentlayer/core/src/ArtifactsDir.ts:29:10
a future continuation at packages/@contentlayer/source-files/src/fetchData/index.ts:54:116

Fiber: #17 (started at: 2022-05-10T06:02:17.445Z) Execution trace:

packages/@contentlayer/core/src/cwd.ts:24:43
packages/@contentlayer/utils/src/node/version.ts:21:15
packages/@contentlayer/utils/src/node/version.ts:20:10
packages/@contentlayer/utils/src/node/fs.ts:62:17
packages/@contentlayer/utils/src/node/fs.ts:61:12
packages/@contentlayer/utils/src/node/fs.ts:44:22
packages/@contentlayer/core/src/ArtifactsDir.ts:25:13
packages/@contentlayer/core/src/DataCache.ts:46:38
packages/@contentlayer/core/src/DataCache.ts:45:12

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chopfitzroycommented, May 11, 2022

Welp! It was next-contentlayer version! I am so sorry!

Closing this issue out now, will re-open if I see it again. Thanks again!

0reactions
schicklingcommented, Sep 5, 2022

@graygalaxy if you’re still facing this issue, please open a new issue with a reproduction repository and link to this issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'cwd' of undefined
Probably the problem is the version of the "babel-jest" module. Try to allineate it with the "jest" module. These are my dependencies in...
Read more >
24.1.0: TypeError: Cannot read property 'cwd' of undefined ...
When I run my tests, I get the following error: ○ Test suite failed to run TypeError: Cannot read property 'cwd' of undefined...
Read more >
TypeError: Cannot read property 'cwd' of undefined-Reactjs
[Solved]-TypeError: Cannot read property 'cwd' of undefined-Reactjs. Probably the problem is the version of the "babel-jest" module. Try to allineate it with ...
Read more >
24.1.0: TypeError: Cannot read property 'cwd' of undefined
When I run my tests, I get the following error: ○ Test suite failed to run TypeError: Cannot read property 'cwd' of undefined...
Read more >
Data Fetching: getStaticProps - Next.js
Reading files: Use process.cwd(). Files can be read directly from the filesystem in getStaticProps . In ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found