Cola_Colin
Cola_Colin

Reputation: 485

npm install fails with 405 Method Not Allowed

I am currently working on upgrade some projects to use node 18 with npm 8, from node 12 with npm 6.

We're using github as npm repository for our private packages.

Now I am getting this error on npm install:

 npm ERR! code E405
 npm ERR! 405 Method Not Allowed - GET https://npm.pkg.github.com/<our-github-organisation>/@types/mime/-/mime-3.0.1.tgz

In the error log:

456 verbose stack HttpErrorGeneral: 405 Method Not Allowed - GET https://npm.pkg.github.com/<our-github-organisation>/@types/mime/-/mime-3.0.1.tgz
456 verbose stack     at /home/cclausen/.nvm/versions/node/v18.7.0/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:93:15
456 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
457 verbose statusCode 405
458 verbose pkgid @types/mime@https://npm.pkg.github.com/<our-github-organisation>/@types/mime/-/mime-3.0.1.tgz

This does not happen on every package, only on a few select ones, I can't see pattern. None of the affected patterns our ours, just random packages.

Why would this happen?

Upvotes: 2

Views: 2509

Answers (1)

Cola_Colin
Cola_Colin

Reputation: 485

It seems the content of the .npmrc file used in the repository to specifc from where to get packages has changed, updating that file to comply with the newest information from githubs documentation has fixed this issue.

So the new content for me is:

@OWNER:registry=https://npm.pkg.github.com

Where OWNER is my organisation.

Upvotes: 1

Related Questions