Solve the error The URL must be of scheme file at xxx\vite.config.ts

The actual error reported is:

failed to load config from xxx\vite.config.ts
error when starting dev server:
Error: The URL must be of scheme file at xxx\vite.config.ts
    at loadConfigFromBundledFile ...

I didn't change any vite.config.ts code, it's completely default. This error has also confused me for a long time.

I checked online and found that some people said that they need to use pnpm to install, and some people say that they need to install vscode plug-ins, but they are not.

In fact, the fundamental problem of this error lies in the version of node. My previous version was: node 16.15.x, and later I reduced the version of node to 16.14.2, and then directly specified the version of pnpm as 8.0.0, and it can be run directly.

 

As for how to change your node version, you can refer to this article: How to downgrade the installed nodejs high version to a low version_node downgrade to a specified version_Who Says♧Autumn Cherry's Blog-CSDN Blog

What needs to be paid attention to is the setting of the environment variable. Don’t set it wrong, otherwise nvm will not be able to install the corresponding correct node version.

At present, I don't know whether there are other ways to solve this error, but I personally tested and changed the version of node today to solve this problem.

After success, it looks like this:

 

Guess you like

Origin blog.csdn.net/XFIRR/article/details/131587950