DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Wow, pnpm, You’re Really Fast
  • Detecting Supply Chain Attacks in NPM, PyPI, and Docker: Real-World Techniques That Work
  • Why Tailwind CSS Can Be Used Instead of Bootstrap CSS
  • Serverless Sign-In Solution Based on Next.js on CloudFare

Trending

  • 7 Technology Waves I’ve Seen in 30 Years of Software — Will AI Be the Next Real Transformation?
  • 5 Common Security Pitfalls in Serverless Architectures
  • Chaos Engineering Has a Blind Spot. Agentic AI Lives in It.
  • Every Cache Miss Is a Tiny Tax on Your Performance
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Forcing an NPM Restore

Forcing an NPM Restore

Facing a situation where you need NPM to restore your packages, especially if you're a Visual Studio user? Then this is your post.

By 
Paul Michaels user avatar
Paul Michaels
·
Mar. 20, 18 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
12.9K Views

Join the DZone community and get the full member experience.

Join For Free

i've recently started looking into the javascript library react.js . having read a couple of tutorials and watched the start of a pluralsight video, i did the usual and started creating a sample application. the react.js template in vs is definitely a good place to start; however, the first issue that i came across was with npm.

upon creating a new web application, i was faced with the following errors:

image title

the reason being that, unlike nuget, npm doesn't seem to sort your dependencies out automatically. after playing around with it for a while, this is my advice to my future self on how to deal with such issues.

the best way for force npm to restore your packages seems to be to call

npm install

either from powershell or from the package manager console inside vs.

powershell

image title

on running this, i found that, despite getting the error shown above, the packages were still restored; however, you can trash that file:

image title

following that, delete the node_modules directory and re-run, and there are no errors:

image title

package manager console

in the package manager console, ensure that you're in the right directory (you'll be in the solution directory by default, which is the wrong directory):

image title

references

https://stackoverflow.com/questions/12866494/how-do-you-reinstall-an-apps-dependencies-using-npm

the post forcing an npm restore appeared first on the long walk .

Npm (software) Package manager

Published at DZone with permission of Paul Michaels. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Wow, pnpm, You’re Really Fast
  • Detecting Supply Chain Attacks in NPM, PyPI, and Docker: Real-World Techniques That Work
  • Why Tailwind CSS Can Be Used Instead of Bootstrap CSS
  • Serverless Sign-In Solution Based on Next.js on CloudFare

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook