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.

"Hanging up"/No start with Next 13

See original GitHub issue

So I have been trying to debug this for the better part of a day, and I am a bit lost. I installed the lts Next (with the app directory) and the contentlayer dependencies (following the example on the site), and it seemed to work for a moment. However, when I reran “yarn dev”, I got the .contentlayer folder with only the cache and my terminal is stuck on the following screen: Screen Shot 2022-11-09 at 8 56 44 AM

I killed the command and reran yarn dev, but then I get:

Screen Shot 2022-11-09 at 8 57 02 AM

Nothing seems to be generated (other than the contentlayer cache), and the site is unreachable.

my contentlayer.config.ts:

import { defineDocumentType, makeSource } from "contentlayer/source-files";

const Doc = defineDocumentType(() => ({
	name: "Doc",
	filePathPattern: "**/*.mdx",
	contentType: "mdx",
	fields: {
		title: { type: "string", required: true },
		description: { type: "string", required: true },
		isPublished: { type: "boolean", required: true },
	},
	computedFields: {
		url: {
			type: "string",
			resolve: (doc) => `/docs/${doc._raw.flattenedPath}`,
		},
	},
}));

export default makeSource({
	contentDirPath: "content",
	documentTypes: [Doc],
});

tsconfig.json:

{
	"compilerOptions": {
		"target": "es5",
		"lib": ["dom", "dom.iterable", "esnext"],
		"allowJs": true,
		"skipLibCheck": true,
		"strict": true,
		"forceConsistentCasingInFileNames": true,
		"noEmit": true,
		"esModuleInterop": true,
		"module": "esnext",
		"moduleResolution": "node",
		"resolveJsonModule": true,
		"isolatedModules": true,
		"jsx": "preserve",
		"incremental": true,
		"baseUrl": ".",
		"paths": {
			"@/styles/*": ["src/styles/*"],
			"contentlayer/generated": ["./.contentlayer/generated"]
		},
		"plugins": [
			{
				"name": "next"
			}
		]
	},
	"include": [
		"next-env.d.ts",
		"**/*.ts",
		"**/*.tsx",
		".next/types/**/*.ts",
		".contentlayer/generated"
	],
	"exclude": ["node_modules"]
}

I probably have missed something important, but for the life of me I can not get it working. I ran into the same issue when I cloned the example next demo as well on Nextjs 13.0.2 with contentlayer 0.2.9 on node 16.18.0 (on mac). I ditched the beta app structure and just went with src/* and a content folder at the root, but I ran into the same issue.

When it did run, it seemed to be very slow and took about a minute to finally get the dev server running. A fresh install sans contentlayer seemed to work just fine.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
lstephenscacommented, Nov 10, 2022

Well, I tried again this morning with the same results with yarn (1.22.19) and npm. However, when I loaded my example repo to Stackblitz it seems to work just fine.

Steps taken:

  • npx create-next-app next-cl --experimental-app
  • npm i contentlayer next-contentlayer
  • Configure next via documentation
  • npm run dev

After some more poking around, I have found that the “export default makeSource” is where it seems to be hanging up in my dev environment. If I comment it out next dev seems to proceed, but as soon as I set “contentDirPath” it completely hangs up after creating 2 files in the .contentlayer cache directory.

Upon further inspection, it seems like there is an issue somewhere down the line with my actual terminal. I tried iterm, hyper, and the built in terminal to no avail. However, the vscode terminal is working just fine. Commence head bashing.

0reactions
lstephenscacommented, Nov 10, 2022

Yep! I appreciate the quick responses!

Read more comments on GitHub >

github_iconTop Results From Across the Web

If your iPhone won't turn on or is frozen - Apple Support
If your iPhone turns on but gets stuck during start up. If you see the Apple logo or a red or blue screen...
Read more >
Galatians 3:13 Christ redeemed us from the curse of the law ...
Christ has purchased our freedom from the curse of the Law by becoming accursed for us--because "Cursed is every one who is hanged...
Read more >
NodeJS - What does "socket hang up" actually mean?
When you are a server/proxy. When you, as a server, perhaps a proxy server, receive a request from a client, then start acting...
Read more >
Dating versus Hanging Out
Start with a variety of dates with a variety of young women, and when that phase yields a good prospect, proceed to courtship....
Read more >
Why did Jesus curse the fig tree? - GotQuestions.org
On His way, both Matthew and Mark record that He was hungry and saw a fig tree in the distance that had leaves...
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