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

vite-plugin-checker invokes node: /usr/bin/env: 'node': No such file or directory #26801

Open
alexgleason opened this issue Nov 9, 2024 · 2 comments
Labels
bug Something isn't working correctly node compat

Comments

@alexgleason
Copy link
Contributor

Version: Deno 2.0.5

Using vite with vite-plugin-checker causes it to invoke Node, and the build fails:

/usr/bin/env: 'node': No such file or directory

Normally Deno is supposed to override calls to node to deno, but it's failing to do so here.

Here is a reproduction Dockerfile:

FROM denoland/deno:2.0.5

WORKDIR /app

RUN deno run -A npm:create-vite@latest -t react-ts .
RUN deno install

RUN deno add npm:vite-plugin-checker

RUN cat <<EOF > vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import checker from 'vite-plugin-checker'

export default defineConfig({
  plugins: [react(), checker({ typescript: true })],
})
EOF

RUN deno run -A npm:vite build

The dockerfile does not build:

➜  vite-deno-repro docker build -t yolo .
[+] Building 1.9s (10/10) FINISHED                                                                                                                                             docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                     0.0s
 => => transferring dockerfile: 461B                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/denoland/deno:2.0.5                                                                                                                           0.2s
 => [internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                          0.0s
 => [1/7] FROM docker.io/denoland/deno:2.0.5@sha256:508bb46f0bb996c60498ddf094324078f05021b08854a3e308dcc1d5a3e36b38                                                                     0.0s
 => CACHED [2/7] WORKDIR /app                                                                                                                                                            0.0s
 => CACHED [3/7] RUN deno run -A npm:create-vite@latest -t react-ts .                                                                                                                    0.0s
 => CACHED [4/7] RUN deno install                                                                                                                                                        0.0s
 => CACHED [5/7] RUN deno add npm:vite-plugin-checker                                                                                                                                    0.0s
 => CACHED [6/7] RUN cat <<EOF > vite.config.ts                                                                                                                                          0.0s
 => ERROR [7/7] RUN deno run -A npm:vite build                                                                                                                                           1.7s
------                                                                                                                                                                                        
 > [7/7] RUN deno run -A npm:vite build:
1.526 vite v5.4.10 building for production...
1.604 /usr/bin/env: 'node': No such file or directory
------
Dockerfile:20
--------------------
  18 |     EOF
  19 |     
  20 | >>> RUN deno run -A npm:vite build
  21 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c deno run -A npm:vite build" did not complete successfully: exit code: 127
@satyarohith satyarohith added bug Something isn't working correctly node compat labels Nov 10, 2024
@sociojs
Copy link

sociojs commented Nov 11, 2024

I think this was caused by npm lifecycle scripts.
I'm facing the same issue while executing the docker production build.

In Dockerfile:

FROM denoland/deno:debian-2.0.3
...
RUN deno install --allow-scripts=npm:[email protected]

Error:

3.345 error: script 'install' in '[email protected]' failed with exit code 1
3.345 stderr:
3.345 /usr/bin/env: 'node': No such file or directory

How to execute npm lifecycle scripts if there is no NodeJs runtime in the Deno docker image? Is there any way to execute npm lifecycle scripts using Deno runtime? Or did I miss something? Any help is much appreciated.

@drewbitt
Copy link

Is there any way to execute npm lifecycle scripts using Deno runtime?

https://docs.deno.com/runtime/reference/cli/install/#native-node.js-addons although no guarantee it solves your issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

No branches or pull requests

4 participants