question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't run npm run build with react bootstrap + ts + sass

See original GitHub issue

Describe the bug

With the latest version, it is not possible to run the build script. It gives a syntax error (see screenshots). The mentioned line and column in the error is consistent irregardless of where the bootstrap import line is.

To Reproduce

Steps to reproduce the behavior:

# 1. Create a basic react typescript template
npx create-react-app my-app --template typescript
# 2. Install react-bootstrap, bootstrap and sass
npm install react-bootstrap@next bootstrap@5.1.0 sass
# 3. Change the template css to scss
mv src/App.css src/App.scss
# 4. Add @import "~bootstrap/scss/bootstrap"; to the top of App.scss
# 5. Change the import from css to scss in App.tsx

Reproducible Example

Cannot reproduce on CodeSandbox, since you can’t run builds there (or I’m blind)

Expected behavior

The build script to complete successfully and filling the build folder.

Screenshots

image

Environment (please complete the following information)

  • Operating System: Windows, also tested on Debian Linux
  • Browser: Irrelevant
  • React-Bootstrap Version: 2.0.0-beta.6

Additional context

Tried talking about this in the Discord channel, at least one other user has the same issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kyletsangcommented, Oct 5, 2021

Bootstrap 5.1.2 has been released with the workaround

4reactions
kyletsangcommented, Sep 18, 2021

Seems like it’s caused by the margin values inside make-row in mixins/_grid.scss.

It’ll compile if I change this:

margin-top: calc(var(--#{$variable-prefix}gutter-y) * -1); // stylelint-disable-line function-disallowed-list
margin-right: calc(var(--#{$variable-prefix}gutter-x) * -.5); // stylelint-disable-line function-disallowed-list
margin-left: calc(var(--#{$variable-prefix}gutter-x) * -.5); // stylelint-disable-line function-disallowed-list

to this:

margin-top: calc(-1 * var(--#{$variable-prefix}gutter-y)); // stylelint-disable-line function-disallowed-list
margin-right: calc(-.5 * var(--#{$variable-prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
margin-left: calc(-.5 * var(--#{$variable-prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
Read more comments on GitHub >

github_iconTop Results From Across the Web

'npm start' returns error: "There might be a problem with the ...
Try running npm ls webpack in your project folder. This will tell you which other package (apart from the expected react-scripts) installed ...
Read more >
Getting Started with Bootstrap 5, React, and Sass - Designmodo
Installing Bootstrap 5. To use Bootstrap 5 with React JS, we need to install it via npm by running the command below on...
Read more >
Webpack - Bootstrap
Install bootstrap as a Node.js module using npm. ... First, create your own _custom.scss and use it to override the built-in custom variables....
Read more >
react-bootstrap - npm
Run the tests once with yarn test (Or run them in watch mode with yarn run tdd ). · Start a local copy...
Read more >
joyson-react-typescript - npm package - Snyk
css to src/App.scss and run npm run watch-css . The watcher will find every Sass file in src subdirectories, and create a corresponding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found