Build error when using react-scripts
See original GitHub issueI’ve ran into a build issue when using this in a project created with create-react-project.
# npm run build
> react-scripts build
Creating an optimized production build...
Failed to compile.
TypeError: C:\Users\Sam\WebstormProjects\untitled1\node_modules\@floating-ui\core\dist\floating-ui.core.browser.min.mjs: Cannot read properties of undefined (reading 'constantViolations')
at transformFile.next (<anonymous>)
at run.next (<anonymous>)
at transform.next (<anonymous>)
The same error doesn’t occour if I repoint it to use the non-minified mjs file.
Reproduction steps (node 18 or 16)
- start new project
npx create-react-app test-bug
- install the react-dom package
npm install @floating-ui/react-dom
- update src/App.js to reference package (example below)
- do
npm run build
import {useFloating} from "@floating-ui/react-dom";
import './App.css';
function App() {
const {x, y, reference, floating, strategy} = useFloating();
return (
<>
<button ref={reference}>Button</button>
<div
ref={floating}
style={{
position: strategy,
top: y ?? 0,
left: x ?? 0,
width: 'max-content',
}}
>
Tooltip
</div>
</>
);
}
export default App;
Issue Analytics
- State:
- Created 9 months ago
- Comments:10
Top Results From Across the Web
react-scripts fails to build project with Node 17 #11562 - GitHub
Describe the bug we have a CRA app, it used to build with Node 14.x very fine, today I upgrade nodejs to 17.0.0...
Read more >react-scripts build error code-134, not creating build
I got my issue resolve by adding below one line of code in package.json "scripts" section. "scripts": {"build": "react-scripts --expose-gc ...
Read more >How to fix build failures with `create-react-app` in production
The build script bootstrapped by create-react-app performs some validation of your code. When most of this validation fails, create-react-app ...
Read more >Fixing 'react-scripts' is not recognized error - Nathan Sebhastian
To fix this kind of error, first check on your package.json file and see if react-scripts is listed as one of the dependencies...
Read more >react-scripts: command not found error [Solved] | bobbyhadz
Run the `npm install react-scripts` command to solve the react-scripts: command not found error. If necessary delete your `node_modules` directory and your ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There may be a bit of a delay in releasing this fix (will be within the next ~1 week though), so in the meantime anyone encountering this issue, install
patch-package
and editnode_modules/@floating-ui/core/package.json
by removing themin
from the"browser"
default field (so it uses the unminified file, it’ll still get minified). This will make your builds work until the patch gets released.Oof yeah… I think they should revert that rewrite they did for now or something and do more testing against it