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
Newsletter
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

  • Kafka vs Flink vs Spark: Do You Really Need Real-Time?
  • Gitember: Building a Git Client Beyond Commit, Push, and Pull
  • Debugging senro Pipelines: Replay a Run, Shell Into a Live Step, Audit a Cache
  • Spring Security JWT Validation Best Practices

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
·
Mar. 20, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
13.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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