Installation of NPM packages failed with "npm notice Access token expired or revoked. Please try logging in again." #181951
-
Select Topic AreaBug BodyRunning Using NPM v11.6.2. How do I fix this problem? I have noticed that NPM recently changed their token security strategy. However, I would expect this to have nothing to do with read-only actions like |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 16 replies
-
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
|
Hey @Vectorial1024! Thanks for reaching out 👋 This behavior is expected after recent npm security updates. As part of these changes, npm access tokens stored in your local To fix this, simply re-authenticate and try again: npm loginor npm adduserOnce logged in again, Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
|
What about when this is on a CI/CD pipeline? We are simply making the granular token for our Gitlab pipeline and setting like so... and we get the error message from this ticket. |
Beta Was this translation helpful? Give feedback.
Hey @Vectorial1024! Thanks for reaching out 👋
This behavior is expected after recent npm security updates. As part of these changes, npm access tokens stored in your local
.npmrcnow expire after 2 hours. When the token expires, commands likenpm installwill fail with the message “Access token expired or revoked”, even for read-only operations.To fix this, simply re-authenticate and try again:
or
Once logged in again,
npm installshould work as expected.Hope it helps!