Search code examples
reactjsnpmcloudflare

Cloudflare --force build for React


00:11:49.557    
00:11:49.558    Using v2 root directory strategy
00:11:49.653    Success: Finished cloning repository files
00:11:51.302    Checking for configuration in a wrangler.toml configuration file (BETA)
00:11:51.302    
00:11:51.425    No wrangler.toml file found. Continuing.
00:11:51.583    Detected the following tools from environment: [email protected], [email protected]
00:11:51.664    Installing project dependencies: npm clean-install --progress=false
00:11:53.563    npm ERR! code ERESOLVE
00:11:53.767    npm ERR! ERESOLVE could not resolve
00:11:53.767    npm ERR! 
00:11:53.768    npm ERR! While resolving: [email protected]
00:11:53.768    npm ERR! Found: [email protected]
00:11:53.769    npm ERR! node_modules/react
00:11:53.769    npm ERR!   react@"^18.3.1" from the root project
00:11:53.769    npm ERR!   peer react@">=18" from @nextui-org/[email protected]
00:11:53.769    npm ERR!   node_modules/@nextui-org/accordion
00:11:53.769    npm ERR!     @nextui-org/accordion@"2.0.38" from @nextui-org/[email protected]
00:11:53.769    npm ERR!     node_modules/@nextui-org/react
00:11:53.769    npm ERR!       @nextui-org/react@"^2.4.6" from the root project
00:11:53.769    npm ERR!   293 more (@react-aria/utils, @react-types/shared, ...)
00:11:53.769    npm ERR! 
00:11:53.769    npm ERR! Could not resolve dependency:
00:11:53.769    npm ERR! peer react@"^16.0.0" from [email protected]
00:11:53.770    npm ERR! node_modules/react-bubble-ui
00:11:53.770    npm ERR!   react-bubble-ui@"^1.1.2" from the root project
00:11:53.770    npm ERR! 
00:11:53.770    npm ERR! Conflicting peer dependency: [email protected]
00:11:53.772    npm ERR! node_modules/react
00:11:53.772    npm ERR!   peer react@"^16.0.0" from [email protected]
00:11:53.772    npm ERR!   node_modules/react-bubble-ui
00:11:53.772    npm ERR!     react-bubble-ui@"^1.1.2" from the root project
00:11:53.772    npm ERR! 
00:11:53.772    npm ERR! Fix the upstream dependency conflict, or retry
00:11:53.772    npm ERR! this command with --force or --legacy-peer-deps
00:11:53.772    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
00:11:53.772    npm ERR! 
00:11:53.772    npm ERR! 
00:11:53.772    npm ERR! For a full report see:
00:11:53.772    npm ERR! /opt/buildhome/.npm/_logs/2024-09-04T07_11_52_421Z-eresolve-report.txt
00:11:53.772    
00:11:53.772    npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-09-04T07_11_52_421Z-debug-0.log
00:11:53.787    Error: Exit with error code: 1
00:11:53.788        at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
00:11:53.788        at Object.onceWrapper (node:events:652:26)
00:11:53.788        at ChildProcess.emit (node:events:537:28)
00:11:53.788        at ChildProcess._handle.onexit (node:internal/child_process:291:12)
00:11:53.799    Failed: build command exited with code: 1
00:11:54.656    Failed: error occurred while running build command

When I get this message, how can I fix it? Or can I deploy the build file? It builds normally on my mac but I don't know how i can use --force for Cloudflare Page!

NO envirnoment variables

Build command:
npm run build
Build output directory:
/build
Root directory:
/
Build comments on pull requests:
Enabled

I tried to change it to npm run build --force but it doesn't change anything.


Solution

  • please add this value in env variables and than try to build don't change npm run build command. NODE_VERSION:16.13.1