Reputation: 1
I am using pnpm to run the development server for my Next.js project. When I execute pnpm dev, the development server starts successfully, but I encounter an error related to contentlayer/generated module. Here's the output I'm seeing: ...
- error ./app/projects/page.tsx:3:0
Module not found: Package path ./generated is not exported from package C:\...\node_modules\contentlayer (see exports field in C:\...\node_modules\contentlayer\package.json)
1 | import Link from "next/link";
2 | import React from "react";
> 3 | import { allProjects } from "contentlayer/generated";
4 | import { Navigation } from "../components/nav";
5 | import { Card } from "../components/card";
6 | import { Article } from "./article";
https://nextjs.org/docs/messages/module-not-found
Related dependencies in package.json:
"dependencies": {
"contentlayer": "^0.3.0",
"next": "13.4.3",
"next-contentlayer": "^0.3.0"
}
It seems that the contentlayer/generated module is not being generated correctly from the contentlayer package. However, I can see that the package is installed correctly in my node_modules directory. I have tried reinstalling the dependencies using pnpm install and even deleting the node_modules folder and reinstalling, but the issue persists.
Additionally, I attempted to clear the pnpm cache by running pnpm store prune to ensure that no cached artifacts were causing the problem. Unfortunately, this did not resolve the error either.
Does anyone have any insights on how to resolve this Module not found error with contentlayer/generated when using pnpm dev?
Upvotes: 0
Views: 1039
Reputation: 1
To resolve this error, I transferred the project files to a directory outside of Dropbox. It appeared that Dropbox's active syncing was causing file locking or permission conflicts during development, causing an "EPERM: operation not permitted" error. After moving the project to a different location, I ran the Next.js development server without encountering the file permission issues after running pnpm install and pnpm dev. This solution ensured a more seamless development experience without disrupting Dropbox's syncing functionality.
Upvotes: 0