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

Uncaught Error: spawnSync npm ENOENT when creating Next.js project using Deno 2 on Ubuntu 24.04 #26232

Closed
frixaco opened this issue Oct 14, 2024 · 5 comments

Comments

@frixaco
Copy link

frixaco commented Oct 14, 2024

deno --version

deno 2.0.0 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2

deno run -A npm:create-next-app@latest results in error: Uncaught Error: spawnSync npm ENOENT:

Creating a new Next.js app in /home/frixaco/personal/test-deno-nextjs.

Using npm.

Initializing project with template: app-tw


Installing dependencies:
- react
- react-dom
- next

Installing devDependencies:
- typescript
- @types/node
- @types/react
- @types/react-dom
- postcss
- tailwindcss
- eslint
- eslint-config-next

error: Uncaught Error: spawnSync npm ENOENT
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_errnoException (ext:deno_node/internal/errors.ts:141:10)
    at _createSpawnSyncError (ext:deno_node/internal/child_process.ts:685:17)
    at new ChildProcess (ext:deno_node/internal/child_process.ts:287:13)
    at Object.spawn (node:child_process:118:10)
    at spawn (file:///home/frixaco/.cache/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:7:76725)
    at file:///home/frixaco/.cache/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:73:33444
    at new Promise (<anonymous>)
    at install (file:///home/frixaco/.cache/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:73:33412)
    at installTemplate (file:///home/frixaco/.cache/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:73:40032)

System:

Fresh install of Ubuntu 2404.1.66.0 inside WSL2 (Windows 11). Only Deno installed in the system.

@littledivy
Copy link
Member

This is not a Deno bug. create-next-app tries to spawn npm by default. You can skip installing using --skip-install and do deno install inside the project.

@frixaco
Copy link
Author

frixaco commented Oct 14, 2024

@littledivy --skip-install doesn't seem to work. Both commands below are returning same error as above:

  • deno run -A npm:create-next-app@latest -- --skip-install
  • deno run -A npm:create-next-app@latest --skip-install

@littledivy
Copy link
Member

Oh it looks like there isn't an option in create-next-app. I'm not sure what can be done here from Deno's side, I would ask Next.js folks to add a --use-deno option or something to skip npm installs.

They do seem to have options for other package managers:

  --use-npm

    Explicitly tell the CLI to bootstrap the application using npm

  --use-pnpm

    Explicitly tell the CLI to bootstrap the application using pnpm

  --use-yarn

    Explicitly tell the CLI to bootstrap the application using Yarn

  --use-bun

    Explicitly tell the CLI to bootstrap the application using Bun

@frixaco
Copy link
Author

frixaco commented Oct 14, 2024

Oh I see. I was wondering why I can't find --skip-install in Deno docs😄. I'll check if there's an open issue for create-next-app to add --use-deno.
Thanks for the quick response!

@Clem-
Copy link

Clem- commented Oct 20, 2024

Hi, maybe the doc should be updated to add the deno install command since create-next-app can't install packages by itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants