[vite] Dep optimization failed with error: Could not load stream ENOENT: no such file or directory
See original GitHub issueDescribe the bug
Vite unable to run after installing package from npm in brand new repository.
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dev --scripts-prepend-node-path=auto
> test-app@0.0.0 dev C:\Users\user\Documents\Programming\test-app
> vite
[vite] Optimizable dependencies detected:
vue, xml-js
[vite] Dep optimization failed with error:
Could not load stream (imported by node_modules\sax\lib\sax.js): ENOENT: no such file or directory, open 'C:\Users\user\Documents\Programming\test-app\stream'
[Error: Could not load stream (imported by node_modules\sax\lib\sax.js): ENOENT: no such file or directory, open 'C:\Users\user\Documents\Programming\test-app\stream'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\user\\Documents\\Programming\\test-app\\stream',
watchFiles: [
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\index.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\vue\\dist\\vue.runtime.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\runtime-dom\\dist\\runtime-dom.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\shared\\dist\\shared.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\runtime-core\\dist\\runtime-core.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\reactivity\\dist\\reactivity.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\json2xml.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\json2xml.js?commonjs-proxy',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\js2xml.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\js2xml.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2json.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2js.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2json.js?commonjs-proxy',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2js.js?commonjs-proxy',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\options-helper.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\options-helper.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\array-helper.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\array-helper.js?commonjs-proxy',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\sax\\lib\\sax.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\sax\\lib\\sax.js',
'\u0000commonjsHelpers.js',
'stream',
'\u0000stream?commonjs-proxy',
'\u0000string_decoder?commonjs-proxy'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-app@0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-app@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-12-24T17_03_20_289Z-debug.log
Process finished with exit code 1
Reproduction
npm init vite-app test-app
cd test-app
npm install --save xml-js
npm run dev
System Info
- required
vite
version: 1.0.0-rc.13 - required Operating System: Windows 10
- required Node version: v12.10.0
- Optional:
- npm/yarn version: 6.10.3
- Installed
vue
version (fromyarn.lock
orpackage-lock.json
): 3.0.4 - Installed
@vue/compiler-sfc
version: 3.0.4
Logs (Optional if provided reproduction)
- Run
vite
orvite build
with the--debug
flag. - Provide the error log here.
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dev --scripts-prepend-node-path=auto
> test-app@0.0.0 dev C:\Users\user\Documents\Programming\test-app
> vite --debug
vite:config env mode: development +0ms
vite:config env: {} +3ms
vite:resolve (node_module entry) vue -> dist/vue.runtime.esm-bundler.js +0ms
vite:optimize optimizing vue (imports sub dependencies) +0ms
vite:resolve (node_module entry) xml-js -> lib/index.js +3ms
vite:optimize optimizing xml-js (no exports, likely commonjs) +2ms
[vite] Optimizable dependencies detected:
vue, xml-js
Pre-bundling them to speed up dev server page load...
(this will be run only when your dependencies have changed)
[vite] Dep optimization failed with error:
Could not load stream (imported by node_modules\sax\lib\sax.js): ENOENT: no such file or directory, open 'C:\Users\user\Documents\Programming\test-app\stream'
[Error: Could not load stream (imported by node_modules\sax\lib\sax.js): ENOENT: no such file or directory, open 'C:\Users\user\Documents\Programming\test-app\stream'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\user\\Documents\\Programming\\test-app\\stream',
watchFiles: [
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\vue\\dist\\vue.runtime.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\index.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\runtime-dom\\dist\\runtime-dom.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\shared\\dist\\shared.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\runtime-core\\dist\\runtime-core.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\@vue\\reactivity\\dist\\reactivity.esm-bundler.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2json.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2json.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2js.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\js2xml.js?commonjs-proxy',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\xml2js.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\json2xml.js',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\js2xml.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\json2xml.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\options-helper.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\options-helper.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\array-helper.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\xml-js\\lib\\array-helper.js?commonjs-proxy',
'C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\sax\\lib\\sax.js',
'\u0000C:\\Users\\user\\Documents\\Programming\\test-app\\node_modules\\sax\\lib\\sax.js?commonjs-proxy',
'\u0000commonjsHelpers.js',
'\u0000stream?commonjs-proxy',
'stream',
'string_decoder',
'\u0000string_decoder?commonjs-proxy'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-app@0.0.0 dev: `vite --debug`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-app@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-12-24T17_08_02_371Z-debug.log
Process finished with exit code 1
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Why vite.js doesn't work when I use npm run dev
Detected inconsistent metadata for the path "node_modules/react/index. js" when it was imported here: node_modules/react/cjs/react-jsx-dev- ...
Read more >Troubleshooting
Also if there is a dependency loop, a full reload will happen. To solve this, try removing the loop. Build #. Built file...
Read more >yarn create vite error - You.com | The AI Search Engine ...
I'm trying to create a frontend project in Vite, using the yarn create vite command, but I'm getting the following error: error with...
Read more >Vite使用Sass报错Dep optimization failed with error
[vite] Dep optimization failed with error: Could not load readline (imported by ... ENOENT: no such file or directory, open ...
Read more >d竖琴的搜索结果_第92页_菜鸟教程网
Vite 使用Sass报错Dep optimization failed with error ? load readline (imported by node_modules\sass\sass.dart.js): ENOENT: no such file or directory, open 'D ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nccurry. The node built-in module is used inside
xml-js
, butvite
is not supported that at now. You can ask the maintainer provider es module bundler.Other,I think this should can be improved in v2 vesion.
@pipe01. You should put
pug
intodevDependencies
.