Reputation: 485
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: 2736
Reputation: 365
I had the exact same problem. When installing with pnpm
, I received the following error:
ERR_PNPM_MISSING_PACKAGE_NAME Can't install ^[version]: Missing package name
However, with npm
I also received a 405 status code.
After trying a lot with uninstalling, clearing cache, etc., the final fix was to release a new version of my private package that I was trying to upgrade. I think something went wrong while publishing on the GitHub registry yesterday, leading to a corrupt package on the registry.
Upvotes: 0
Reputation: 1
I faced the same issue with my personal package published on a Git registry where installation failed without a clear error message. Initially, I suspected the problem might be related to my Node.js or npm versions, so I updated both to the latest versions, but the issue persisted. I also checked my package.json
, dependencies, and repository settings, but nothing seemed to be misconfigured.
After further investigation, I discovered that the issue was caused by the presence of the README.md
file in the package. Private packages on certain Git registries do not allow README.md
files or may have restrictions on certain characters within them. Deleting the README.md
file from the repository resolved the issue, and I was able to install the package successfully.
This problem might not always be obvious because package managers do not always provide explicit errors related to README.md
. If anyone else encounters a similar issue, they should try removing or modifying README.md
to see if that resolves the problem.
Upvotes: 0
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