Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
925 stars 140 forks source link

Cannot find module './types/arazzo' #1647

Closed Hector-f-Romero closed 2 months ago

Hector-f-Romero commented 2 months ago

Describe the bug Today I am documenting a project and I executed the command npx @redocly/cli build-docs ./docs/openapi.yaml --output ./docs/docs.html in my case. Previous days I have used this same problem and I generated the corresponding docs.html

Now the console show me the next error:

node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module './types/arazzo'
Require stack:
- C:\Users\hecto\AppData\Local\npm-cache\_npx\1738445911c9ab26\node_modules\@redocly\openapi-core\lib\index.js
- C:\Users\hecto\AppData\Local\npm-cache\_npx\1738445911c9ab26\node_modules\@redocly\cli\lib\index.js
- C:\Users\hecto\AppData\Local\npm-cache\_npx\1738445911c9ab26\node_modules\@redocly\cli\bin\cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\Users\hecto\AppData\Local\npm-cache\_npx\1738445911c9ab26\node_modules\@redocly\openapi-core\lib\index.js:28:16)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\hecto\\AppData\\Local\\npm-cache\\_npx\\1738445911c9ab26\\node_modules\\@redocly\\openapi-core\\lib\\index.js',
    'C:\\Users\\hecto\\AppData\\Local\\npm-cache\\_npx\\1738445911c9ab26\\node_modules\\@redocly\\cli\\lib\\index.js',   
    'C:\\Users\\hecto\\AppData\\Local\\npm-cache\\_npx\\1738445911c9ab26\\node_modules\\@redocly\\cli\\bin\\cli.js'      
  ]
}

Expected behavior Redoc generates the corresponding docs.html file as it did before

Additional context I have already removed the node_modules and used commands such as npm cache clean --force and npm i, but the error persists.

lornajane commented 2 months ago

Thanks @Hector-f-Romero for the bug report. I think this problem relates to Redocly CLI, so I've transferred it to the repo for that project. Does using a specific version of the CLI help? For example if you change your command to:

npx @redocly/cli@1.17.0 build-docs ./docs/openapi.yaml --output ./docs/docs.html

Can you let us know if you see the same problem with this command?

Hector-f-Romero commented 2 months ago

With npx @redocly/cli@1.17.0 can generate the html file without problems. Thanks for help.

Redoc works

tatomyr commented 2 months ago

Maybe some kind of local cache? Does it throw the error if you install the latest version of Redocly CLI?

jeremyfiel commented 2 months ago

He's using npx, so there shouldn't be any local install to consider.

Hector-f-Romero commented 2 months ago

He's using npx, so there shouldn't be any local install to consider.

I haven't installed redocly/cli, redoc or something like that. When I have used npm list or npm list -g I do not find any coincidence.

At some point I used npm cache clean --force as explained above, but not works.

RomanHotsiy commented 2 months ago

He's using npx, so there shouldn't be any local install to consider.

npx has some quirks. It caches the installed modules in some weird ways sometimes. I think we can close this issue for now.