[vite:build-html] EISDIR: illegal operation on a directory, read

See original GitHub issue

Describe the bug

Build process fails if html contains an image tag with a blank src attribute:

<img src="" />

Results in the following npm console error:

file: {PROJECT_ROOT_DIRECTORY}/index.html
error during build:
Error: EISDIR: illegal operation on a directory, read
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio@0.1.0 build: `vite build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Full npm debug log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.9
3 info using node@v14.15.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle portfolio@0.1.0~prebuild: portfolio@0.1.0
6 info lifecycle portfolio@0.1.0~build: portfolio@0.1.0
7 verbose lifecycle portfolio@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle portfolio@0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\{SOME_USER}\Documents\My Projects\Portfolio\node_modules\.bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\{SOME_USER}\AppData\Local\Microsoft\WindowsApps;;C:\Users\{SOME_USER}\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\{SOME_USER}\AppData\Roaming\npm;C:\Program Files\heroku\bin
9 verbose lifecycle portfolio@0.1.0~build: CWD: C:\Users\{SOME_USER}\Documents\My Projects\Portfolio
10 silly lifecycle portfolio@0.1.0~build: Args: [ '/d /s /c', 'vite build' ]
11 silly lifecycle portfolio@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle portfolio@0.1.0~build: Failed to exec build script
13 verbose stack Error: portfolio@0.1.0 build: `vite build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid portfolio@0.1.0
15 verbose cwd C:\Users\{SOME_USER}\Documents\My Projects\Portfolio
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.15.3
19 verbose npm  v6.14.9
20 error code ELIFECYCLE
21 error errno 1
22 error portfolio@0.1.0 build: `vite build`
22 error Exit status 1
23 error Failed at the portfolio@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Reproduction

See bug description.

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 10.07 GB / 15.96 GB
  Binaries:
    Node: 14.15.3 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.9 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.59)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    vite: ^2.3.8 => 2.3.8

Used Package Manager

npm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nassosyiancommented, Nov 16, 2021

btw this also happens with empty src attribute in <img> and <video>

2reactions
blaketrahancommented, Aug 3, 2021

I ran into this same error, except it was a link tag: <link rel="icon" href="" /> in my index.html file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[vite] Internal server error: EISDIR: illegal operation on a ...
I believe vite was trying to load the /users/me directory on my computer, which it doesn't have access too, and thus the error....
Read more >
vite:load-fallback - Could not load /path/to/package EISDIR
svelte): EISDIR: illegal operation on a directory, read I have tried to change the exports in package.json and removed all dependecy on svelte/ ......
Read more >
vite internal server error - You.com | The AI Search Engine ...
Weird Vite error: [vite] Internal server error: EISDIR: illegal operation on a directory, read. Asked Dec 23, 2021 • 0 votes 1 answer....
Read more >
vite实践遇到的问题[vite:build-html] EISDIR
使用vite打包出现的错误,开发环境运行正常。 经过排查是因为link的href为空,删掉href后打包正常。唔,资源引入这块要注意了一. 记录一下.
Read more >
eisdir - Reddit post and comment search
svelte): EISDIR: illegal operation on a directory, read error during build: Error: Could not load /.../tester/node_modules/stwui (imported by src/routes/+page.
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