简体   繁体   中英

npm Unable To Install Packages From JSON File

This Question is for sharing my experience

I have downloaded a boilerplate repository from github. In order to install the packages from JSON file. I run the following command npm install It was throwing random errors. After googling for about two days I couldn't figure it out. I have tried various solutions on the stack overflow website none of them helped.

Well The solution for my problem was the versions of the packages that were used in the boilerplate. the boilerplate was uploaded almost a year ago on github since it was not being updated. As is downloaded it and tried to install the packages meanwhile the version numbers mentioned in the package.json file were no longer supported by the npm package manager. I figured it our by manually going through each package and dependency and by installing them one by one with the latest version.

I don't know about the error you're saying, getting after running npm install as you haven't posted the errors. But If it is the problem of versions as you described in the answer, you don't have to check for each package manually to see through which ones are outdated and all.

You can simply run the following command to see the dependencies that are outdated or needs your attention in terms of updates.

npm outdated

This command will simply list down all the dependencies you have installed and check for the updates needed, like this: 在此处输入图像描述

Here you can see all the information. Even in the wanted tab you can see the minimum needed for your project. Which is quite helpful.

Now, you can simply update one by one after seeing these stats or run the following command to update all at once.

npm update

This will simply update all your dependencies to their shiny new versions.

I hope this solves your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM