简体   繁体   中英

How can I install two versions of Bootstrap with NPM into a single node_modules folder?

I'm issuing the following npm command to install some files needed by Bootstrap:

npm install browser-sync gulp gulp-sass --save-dev

After this runs, there are 492 folders that contain over 55 MB files installed into the node_modules folder before I've even installed Bootstrap.

I'm trying to install two versions of Bootstrap. I already have version 4 installed, but would also like to install Bootstrap 5 alpha 2, but it seems only one version can live in node_modules at a time. So I have to add a new folder with another node_modules folder full of all these files just to run another version of Bootstrap.

Is there any way I can install two versions of Bootstrap into one node_modules folder to avoid all these duplicate files? Thanks.

I ran into a similar issue, because in my company project I had another websites that needs older version of bootstrap. So, in a research, based on this answer , the v6.9.0, Mar 2019 of NPM supports aliases. So, all you need to do is to install the duplicated package under an alias, like:

npm install legacy-bootstrap@npm:bootstrap@v4.0.0-alpha.6

Then, instead of include/require bootstrap/js/tab.js you will need to require legacy-bootstrap/js/tab.js

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