Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with windows and Nuxt3 #86

Open
alexiokay opened this issue Nov 26, 2022 · 10 comments
Open

Doesn't work with windows and Nuxt3 #86

alexiokay opened this issue Nov 26, 2022 · 10 comments

Comments

@alexiokay
Copy link

alexiokay commented Nov 26, 2022

https://github.com/nuxt-community/robots-module/issues/64

ERROR [worker reload] [worker init] Only file and data URLs 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: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 ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36)

@alexiokay alexiokay changed the title Doesn't work in windows and Nuxt3 Doesn't work with windows and Nuxt3 Nov 26, 2022
@seangwright
Copy link

Same, here's my error:

 ERROR  (node:23052) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

√ Nitro built in 492 ms                                                                   nitro 15:17:22
i Vite client warmed up in 3593ms                                                               15:17:22

 ERROR  [worker reload] [worker init] 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 'd:'

  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 ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)                        15:17:16  
  at link (node:internal/modules/esm/module_job:75:36)

ENV

Windows 10

> node -v
v18.12.1

package.json

  "dependencies": {
    "highlight.js": "11.7.0",
    "vue-gtag-next": "1.14.0"
  },
  "devDependencies": {
    "autoprefixer": "10.4.13",
    "nuxt": "3.0.0",
    "postcss": "8.4.19",
    "prettier": "2.8.0",
    "tailwindcss": "3.2.4",
    "typescript": "4.9.3",
    "vue-tsc": "1.0.11"
  },
  "engines": {
    "node": ">= 18.12.1"
  }

@MuhammadM1998
Copy link

Same error on nuxt dev. nuxt generate works

 ERROR  [worker reload] [worker init] 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 'e:'

  at new NodeError (node:internal/errors:393:5)  at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:986:11)
  at defaultResolve (node:internal/modules/esm/resolve:1066:3)
  at nextResolve (node:internal/modules/esm/loader:161:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:831:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:413:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)

@MuhammadM1998
Copy link

Anyone got this to work?

@Slowhalfframe
Copy link

Same error on nuxt dev. nuxt generate works

 ERROR  [worker reload] [worker init] 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 'e:'

  at new NodeError (node:internal/errors:393:5)  at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:986:11)
  at defaultResolve (node:internal/modules/esm/resolve:1066:3)
  at nextResolve (node:internal/modules/esm/loader:161:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:831:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:413:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)

Same mistake.

@Gumbraise
Copy link

Hey guys, I maybe solved the issue. Create a file named robots.config.ts on your Nuxt root. And add this is it:

export default [
    { UserAgent: '*' },
    { Disallow: '/' },
    { BlankLine: true },
    { Comment: 'Comment here' },

    { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` }
]

This solved the issue for me

@MuhammadM1998
Copy link

@Gumbraise What you done is a workaround. The issue is not in the robots module itself

@Createitv
Copy link

Hey guys, I maybe solved the issue. Create a file named robots.config.ts on your Nuxt root. And add this is it:

export default [
    { UserAgent: '*' },
    { Disallow: '/' },
    { BlankLine: true },
    { Comment: 'Comment here' },

    { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` }
]

This solved the issue for me

Thanks! This also work for me

@Hossara
Copy link

Hossara commented Mar 30, 2023

Hey guys, I maybe solved the issue. Create a file named robots.config.ts on your Nuxt root. And add this is it:

export default [
    { UserAgent: '*' },
    { Disallow: '/' },
    { BlankLine: true },
    { Comment: 'Comment here' },

    { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` }
]

This solved the issue for me

This also work for me. Thanksssssss a lot.

@kordoulakis
Copy link

Workaround worked for me in Nuxt 3 as well.

Hey guys, I maybe solved the issue. Create a file named robots.config.ts on your Nuxt root. And add this is it:

export default [
    { UserAgent: '*' },
    { Disallow: '/' },
    { BlankLine: true },
    { Comment: 'Comment here' },

    { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` }
]

This solved the issue for me

@Xyrai
Copy link

Xyrai commented Jul 25, 2023

Since this seems to be the current fix, make sure that the set values align with your robots.txt requirements before copy pasting the content.

Hey guys, I maybe solved the issue. Create a file named robots.config.ts on your Nuxt root. And add this is it:

export default [
    { UserAgent: '*' },
    { Disallow: '/' },
    { BlankLine: true },
    { Comment: 'Comment here' },

    { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` }
]

This solved the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants