nuxt-modules / robots

Tame the robots crawling and indexing your Nuxt site.
https://nuxtseo.com/robots
412 stars 30 forks source link

模块引入后报错 #95

Closed GX88 closed 2 months ago

GX88 commented 1 year ago

首先很抱歉,我的英文不太好。我这边新增一个模块报错。我的版本为下述。我想问导致这个问题的原因。我的开发环境是window11

 {
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev -o",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "start": "node .output/server/index.mjs"
  },
  "devDependencies": {
    "@types/node": "^18.15.5",
    "nuxt": "^3.3.1"
  },
  "dependencies": {
    "@nuxtjs/robots": "^3.0.0",
    "@pureadmin/utils": "^1.8.5"
  }
}
 ERROR  [worker reload] [worker init] Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'                                                           17:06:06  

  at new NodeError (node:internal/errors:399:5)
  at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1059:11)
  at defaultResolve (node:internal/modules/esm/resolve:1135:3)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)
gyhyfj commented 1 year ago

confirm, same problem

GX88 commented 1 year ago

确认,同样的问题

I have fixed this issue now, If you are in the window environment, you need to create a config file in the project root directory image

GX88 commented 1 year ago

确认,同样的问题

Also, I suggest changing to a robots module, such as "nuxt-simple-robots". You can find information about this module in Nuxt3's documentation. Of course, for simple use, your project is not responsible. image