admin管理员组

文章数量:1290945

I'm new to Node.js and installed nodejs using asdf-vm on my WSL2 ArchLinux environment. When attempting to install the react-icons or any package using npm, I encountered the following error:

❯ npm install react-icons
npm error code E404
[...]

The command npm install react-icons resulted in a 404 Not Found error, indicating that the package could not be found in the npm registry. However, after changing the npm registry to use HTTP instead of HTTPS with the command npm config set registry /, the installation was successful.

Step-by-step exemple:

- Prerequisites: Assuming asdf is already installed.

  1. asdf plugin-add nodejs .git

  2. asdf list all nodejs

  3. asdf install nodejs latest

  4. asdf local nodejs <versao>

  5. npx create-next-app@latest

  6. cd my-nextjs-app

  7. npm install react-icons

  8. Encountering npm error code E404

  9. npm config set registry /

  10. Encountering npm error code E404

  11. npm config set registry /

  12. npm install react-icons

  13. Success! react-icons should now install

I'm trying to understand why the installation failed when using HTTPS and succeeded after switching to HTTP. Is this behavior expected, and are there any security implications associated with using HTTP instead of HTTPS for npm registry access?

本文标签: nodejsnpm install results in E404 error with HTTPSresolved by switching to HTTP registryStack Overflow