tailwind-nextjs-starter-blog icon indicating copy to clipboard operation
tailwind-nextjs-starter-blog copied to clipboard

Error when creating new project using Pliny project CLI

Open rahimratnani opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

Getting ERR_MODULE_NOT_FOUND error when creating a new project using Pliny project CLI.

To Reproduce Steps to reproduce the behavior:

  1. Install Pliny project CLI: npm i -g @pliny/cli
  2. Create a new project: pliny new --template=starter-blog my-blog
  3. Navigate to project directory: cd my-blog
  4. Run npm run dev to start the development server
  5. Go to http://localhost:3000 in browser
  6. See the error in CLI

Expected behavior The http://localhost:3000 should load the page normally without crashing the application.

Error trace

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/rahim/Projects/my-blog/node_modules/next/script' imported from /home/rahim/Projects/my-blog/node_modules/pliny/dist/chunk-J2TU2LAM.mjs
Did you mean to import next/script.js?
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/rahim/Projects/my-blog/node_modules/next/script' imported from /home/rahim/Projects/my-blog/node_modules/pliny/dist/chunk-J2TU2LAM.mjs
Did you mean to import next/script.js?
    at new NodeError (node:internal/errors:372:5)
    at finalizeResolution (node:internal/modules/esm/resolve:437:11)
    at moduleResolve (node:internal/modules/esm/resolve:1009:10)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  page: '/'
}

System Info (if dev / build issue):

  • OS: Ubuntu 22.04.1 LTS x86_64
  • Node version: 16.16.0
  • Npm version: 8.11.0

Browser Info (if display / formatting issue):

  • Device: Desktop
  • Browser: Chrome
  • Version 104.0.5112.101

Additional context I tried removing node_modules directory and re-installing the dependencies using npm i but still got the same error.

rahimratnani avatar Aug 24 '22 05:08 rahimratnani

i'm facing same error.

plagdoctor avatar Aug 26 '22 09:08 plagdoctor

I tried git clone project this time, I don't get any moddule not found errors.

plagdoctor avatar Aug 26 '22 09:08 plagdoctor

@plagdoctor Cloning the repo and creating a new project using npx degit both are working fine. The error I'm getting is with Pliny project CLI and since it's the recommended way, I thought of creating an issue.

rahimratnani avatar Aug 27 '22 04:08 rahimratnani

Thanks for reporting. Sorry about it, will take a look at the issue over the weekends.

timlrx avatar Sep 09 '22 15:09 timlrx

I have the same error.

swamidass avatar Oct 05 '22 04:10 swamidass

Can confirm

kobiebotha avatar Oct 17 '22 03:10 kobiebotha

Sorry it took a while to fix - there were just too many bundling, packaging issues and the combination of preact, react 18, esbuild, contentlayer, nextjs makes it more difficult than I imagine to resolve all the issues. Most of the issues should be fixed now, but do let me know if you run into any more problems.

timlrx avatar Oct 24 '22 15:10 timlrx