X [ERROR] [plugin esbuild-style-plugin] PostCSS config file at E:\...\postcss.config.js can't load

483 views Asked by At

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:' at new NodeError (node:internal/errors:371:5) at defaultResolve (node:internal/modules/esm/resolve:1016:11) at ESMLoader.resolve (node:internal/modules/esm/loader:422:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40) at ESMLoader.import (node:internal/modules/esm/loader:276:22) at importModuleDynamically (node:internal/modules/cjs/loader:1041:29) at importModuleDynamicallyWrapper (node:internal/vm/module:437:21) at importModuleDynamically (node:vm:381:46) at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) at importPostcssConfigFile (E:\Team###NileDashboard\nile-dashboard\node_modules\esbuild-style-plugin\dist\index.js:76:22) { code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME' ...

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:' at new NodeError (node:internal/errors:371:5) at defaultResolve (node:internal/modules/esm/resolve:1016:11) at ESMLoader.resolve (node:internal/modules/esm/loader:422:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40) at ESMLoader.import (node:internal/modules/esm/loader:276:22) at importModuleDynamically (node:internal/modules/cjs/loader:1041:29) at importModuleDynamicallyWrapper (node:internal/vm/module:437:21) at importModuleDynamically (node:vm:381:46) at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) at importPostcssConfigFile (E:\Team###NileDashboard\nile-dashboard\node_modules\esbuild-style-plugin\dist\index.js:76:22) { code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME' } X [ERROR] [plugin esbuild-style-plugin] PostCSS config file at E:...\postcss.config.js can't load.

when I npm start my react app in windows, I got this error(X [ERROR] [plugin esbuild-style-plugin] PostCSS config file at E:...\postcss.config.js can't load. and also this Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows10, absolute paths must be valid file:// URLs. ). I think this project was configured on mac os. node version 16.13.1

1

There are 1 answers

0
David On

Cannot speak for Windows, but I was able to resolve this same error on my Linux system by

  1. using Nvm to update Node to a later version

-- How to properly upgrade node using nvm

-- How To Install or Update Node by Using nvm

  1. updating the version of node that pm2 was running, by the following command:

pm2 reload app --update-env:

-

More information about it:

pm2 list will show the apps pm2 is running e.g. suppose you're only running one, named app

pm2 show app will show you which Node version pm2 is using. In the output you may see

node.js version │ 14.20.0

After updating your node version with nvm, you need to run

pm2 reload app --update-env which should update the version of node that pm2 is using with this process.