Error configuring Bootstrap.Native with Phoenix Liveview

I’m trying to configure Bootstrap.Native by following this tutorial:
https://dashbit.co/blog/using-bootstrap-native-with-live-view

But when I try to import JS, import “bootstrap.native” I’m getting the following error:

ERROR in ./node_modules/bootstrap.native/dist/bootstrap-native.esm.js
Module build failed (from ./node_modules/bootstrap.native-loader/index.js):
Error: Cannot find module ‘bootstrap.native/lib/build-module.js’

Hello and welcome,

before doing this, there is a note in the post…

Edit: this post was written for Bootstrap v4. Bootstrap v5 does away with the jQuery dependency.

Because it’s probably easier to try to install Phoenix with Bootstrap 5 alpha :slight_smile:

Hi, it seems the Bootstrap Native Loader version 2, currently does not support the newer version of Bootstrap Native. It supports version 2.

So in your assets/package.json, you can change the version to:
"bootstrap.native": "^2.0.26",

1 Like

OP were you able to resolve this?

I see this error after setting "bootstrap.native": "^2.0.26"

ERROR in ./node_modules/bootstrap.native/dist/bootstrap-native.js
Module build failed (from ./node_modules/bootstrap.native-loader/index.js):
Error: Cannot find module 'uglify-js'

npm install --save-dev uglify-js

seems to fix it. Though I was expecting this dependency to be auto-installed