Tag Archives: hurry up

[vite] Internal server error:options.devServer.transformWidthEsBuild is not a function…

[vite] Internal server error:options.devServer. transformWidthEsBuild is not a function…

Vite2.x upgrade Vite3.x error reported this message

Solution:

In addition to upgrading Vite itself, it is best to upgrade all plugins involved in Vite in package.json devDependencies development dependencies, such as @vitejs/plugin-vue, @vitejs/plugin-legacy, etc.

If not yet solved, try to upgrade the plugins corresponding to Vite involving eslint and so on.

[Solved] Vite Error: Failed to load module script: Expected a JavaScript module script but the server…

Error message

Use the white screen of the web page packaged by vite, and the console reports an error.

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec.

reason

MIME type errors are generally a problem with native windows development. I encountered this after opening it with Python’s built-in http.server on Windows.

Solution

Deploy the packaged files in a formal server environment (such as nginx and Apache)

[Solved] Temporary error: Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT

PS E:\vue3-vite\my-app> npm run dev

> [email protected] dev
> vite

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn E:\\vue3-vite\\my-app\\node_modules\\esbuild\\esbuild.exe',
  path: 'E:\\vue3-vite\\my-app\\node_modules\\esbuild\\esbuild.exe',
  spawnargs: [ '--service=0.12.22', '--ping' ]
}
npm ERR! code 1
npm ERR! path E:\vue3-vite\my-app
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c vite

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\node\node_cache\_logs\2021-08-26T02_24_14_376Z-debug.log

Solution: node node_modules/esbuild/install.js

PS E:\vue3-vite\my-app> node node_modules/esbuild/install.js
PS E:\vue3-vite\my-app> npm run dev

> [email protected] dev
> vite

Pre-bundling dependencies:
  vue
(this will be run only when your dependencies or config have changed)

  vite v2.5.1 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 1645ms.