modernweb-dev / rocket

The modern web setup for static sites with a sprinkle of JavaScript
https://rocket.modern-web.dev
MIT License
368 stars 51 forks source link

Running ``npm run build`` in the blog starter kit leads to an ``ERR_UNSUPPORTED_ESM_URL_SCHEME`` error when run on windows #447

Open Pakkanen1 opened 2 years ago

Pakkanen1 commented 2 years ago

I wanted to test out how to create a blog with Rocket, but it seems running npm run build leads to an error with absolute paths on windows. I couldn't find any specific info about Rocket not supporting windows so I'm assuming it would. Correct me if I'm wrong.

I followed the instructions here: https://github.com/modernweb-dev/rocket/tree/main/examples/02-blog-starter

OS: Windows 10 (Build 19044.2130) Node: 18.12.0 npm: 8.19.2

Steps to reproduce:

  1. run npx @rocket/create@latest --template 02-blog-starter in an empty folder
  2. navigate to that folder and run npm install
  3. run npm run build Error:
C:\gitnation\dndblog\rocket-02-blog-starter>npm run build

> rocket-blog-starter@0.0.1 build
> rocket build

node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:393:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1026:11)
    at defaultResolve (node:internal/modules/esm/resolve:1106:3)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/esm/translators:110:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at RocketCli.applyConfigFile (file:///C:/gitnation/dndblog/rocket-02-blog-starter/node_modules/@rocket/cli/src/RocketCli.js:124:27) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Node.js v18.12.0

As a sidenote, I also needed to delete the .degit folder just to get npx @rocket/create@latest to work. The NODE_DEBUG environment variable also doesn't work when running npm run start but changing it to SET NODE_DEBUG seems to help.