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

Install module make 405 Method not Allowed issue #510

Open
SwartZCoding opened this issue Oct 14, 2024 · 11 comments · May be fixed by #519
Open

Install module make 405 Method not Allowed issue #510

SwartZCoding opened this issue Oct 14, 2024 · 11 comments · May be fixed by #519

Comments

@SwartZCoding
Copy link

Hello everyone !

When i try to do the command : npx nuxi@latest module add @nuxtjs/tailwindcss, i recieve this error response. I have already try with others modules and i have the same issue.

Thanks in advance for all help i can recieve !

Environement :
Node: v20.18.0
OS : Windows 11

` ERROR [GET] "https://npm.pkg.github.com//@nuxtjs/tailwindcss/latest": 405 Method Not Allowed 09:05:15

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async $fetch2 (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/shared/nuxi.b88e7b0f.mjs:340:15)
at async resolveModule (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/chunks/add2.mjs:262:15)
at async Object.setup (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/chunks/add2.mjs:136:15)
at async runCommand$1 (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1620:5)
at async runCommand$1 (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1639:11)
at async runCommand$1 (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1639:11)
at async runMain$1 (/C:/Users/alter/Documents/extranet-web/node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1777:7)`

@Tcheikovski
Copy link

Tcheikovski commented Oct 14, 2024

Same error here on a fresh project, with any module (tried with @nuxt/eslint, @nuxt/ui, @nuxtjs/i18n, nuxt-auth-utils)

Environement :
Node : v21.6.2
OS : Windows 10 Pro

Note for OP @SwartZCoding : your error message should be between triple backticks to display it correctly : ``` Error..... ```

@manniL
Copy link
Member

manniL commented Oct 15, 2024

Do you have any custom registry set up?

@SwartZCoding
Copy link
Author

Do you have any custom registry set up?

no, personally, try with a fresh nodejs install & clean of my config

@abedio
Copy link

abedio commented Oct 15, 2024

Same error here on a fresh project, with module @nuxtjs/i18n.

Environement :
Node : v20.18.0
OS : Debian GNU/Linux 12 (bookworm)

@Tcheikovski
Copy link

Do you have any custom registry set up?

I do, but I already tried removing it, with the same result

@sgarciac
Copy link

Same problem here.

@naseefpv
Copy link

Same here, Tried to install Nuxt Scripts. got "https://npm.pkg.github.com//@nuxt/scripts/latest": 405 Method Not Allowed

@skarnl
Copy link

skarnl commented Oct 16, 2024

Glad i found this issue, I was worried the error was on my machine.
Just to give an additional +1 and maybe some helpful debug info:

❯ npx nuxi@latest module add i18n

ERROR  [GET] "https://npm.pkg.github.com//@nuxtjs/i18n/latest": 405 Method Not Allowed                 

  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async $fetch2 (node_modules/nuxi/dist/shared/nuxi.b88e7b0f.mjs:340:15)
  at async resolveModule (node_modules/nuxi/dist/chunks/add2.mjs:262:15)
  at async Object.setup (node_modules/nuxi/dist/chunks/add2.mjs:136:15)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1620:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1639:11)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.3e201632.mjs:1777:7)

( and the same for another module, npx nuxi@latest module add cookie-control )

@tkjaergaard
Copy link

Might be the same as #498

@manniL
Copy link
Member

manniL commented Oct 16, 2024

It is indeed the same @tkjaergaard. Closing the linked on in favor if this due to activity)

@tkjaergaard
Copy link

tkjaergaard commented Oct 17, 2024

So the error happens here: https://github.com/nuxt/cli/blob/main/src/commands/module/add.ts#L276

It takes the first match with /registry=(.*)/ in the resolved .npmrc file. In my case it was ~/.npmrc

The issue was introduced in #470.

It seems that the regex is not considering the "scope" defined prior to registry= e.g.: @myscope:registry=https://npm.pkg.github.com/

So even though you have specified that the registry should only work for a specific scope, getRegistryFromFile takes the first match and use it as the registry.

Maybe an additional scope check in getRegistryFromFile should be implemented?

tkjaergaard added a commit to tkjaergaard/nuxt-cli that referenced this issue Oct 17, 2024
@tkjaergaard tkjaergaard linked a pull request Oct 17, 2024 that will close this issue
1 task
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

Successfully merging a pull request may close this issue.

8 participants