I tried to deply my React file from codesandbox, but failed many many times…
message said
“2022-02-06 19:28:47.856 - yarn install v1.22.5 info No lockfile found. [1/4] Resolving packages… [2/4] Fetching packages… info Visit yarn install | Yarn for documentation about this command. | warning package.json: No license field warning udemy-react2-chakura1208@1.0.0: No license field warning @types/react-router-dom > @types/history@5.0.0: This is a stub types definition. history provides its own type definitions, so you do not need this installed. warning react-scripts > workbox-webpack-plugin > source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments. warning react-scripts > workbox-webpack-plugin > workbox-build > source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments. warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. error eslint@8.8.0: The engine “node” is incompatible with this module. Expected version “^12.22.0 || ^14.17.0 || >=16.0.0”. Got “14.16.0” error Found incompatible module.”
This error is because there is no yarn.lock file in the repository. As per this documentation Netlify will use yarn if there is a yarn.lock or the NETLIFY_USE_YARN environment variable is set to true.
When deploying the project this is the error I see
8:20:44 AM: npm ERR! code ERESOLVE
8:20:44 AM: npm ERR! ERESOLVE unable to resolve dependency tree
8:20:44 AM: npm ERR!
8:20:44 AM: npm ERR! While resolving: udemy-react2-chakura1208@1.0.0
8:20:44 AM: npm ERR! Found: framer-motion@3.3.0-beta.22
8:20:44 AM: npm ERR! node_modules/framer-motion
8:20:44 AM: npm ERR! framer-motion@"3.3.0-beta.22" from the root project
8:20:44 AM: npm ERR!
8:20:44 AM: npm ERR! Could not resolve dependency:
8:20:44 AM: npm ERR! peer framer-motion@">=3.0.0" from @chakra-ui/react@1.2.1
8:20:44 AM: npm ERR! node_modules/@chakra-ui/react
8:20:44 AM: npm ERR! @chakra-ui/react@"1.2.1" from the root project
8:20:44 AM: npm ERR!
8:20:44 AM: npm ERR! Fix the upstream dependency conflict, or retry
8:20:44 AM: npm ERR! this command with --force, or --legacy-peer-deps
8:20:44 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
8:20:44 AM: npm ERR!
8:20:44 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
8:20:44 AM: npm ERR! A complete log of this run can be found in:
8:20:44 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-02-06T21_20_44_230Z-debug.log
There is a issue with the dependencies for the project. This issue happens locally as well—it is not Netlify-specific. In order to install all the dependencies locally npm i --force or npm i --legacy-peer-deps is used as stated in the in the log above. To mimic this on Netlify, you need add the NPM_FLAGS environment variable (see Declare variables) with either of these values.
Thank you so much for your advice. I installed npm i --force and npm i --legacy-peer-deps but failed. Could you kindly advice what value should I add NPM_FLAGS??
I am totally beginner of these things…
I tried to paste the log, but could not let me paste here…
I reverted to the original tsconfig.json and updated react-scripts to v5.0.0. This removed the error
appTsConfig.compilerOptions[option] = suggested;
This then lead to the following error
11:46:47 AM: Failed to compile.
11:46:47 AM:
11:46:47 AM: src/components/organisms/layout/Header.tsx
11:46:47 AM: Line 1:1: Definition for rule 'react-hooks/exhaustive-deps' was not found react-hooks/exhaustive-deps
11:46:47 AM: src/components/pages/UserManagement.tsx
11:46:47 AM: Line 1:1: Definition for rule 'react-hooks/exhaustive-deps' was not found react-hooks/exhaustive-deps
11:46:47 AM: src/hooks/useAllUsers.ts
11:46:47 AM: Line 1:1: Definition for rule 'react-hooks/exhaustive-deps' was not found react-hooks/exhaustive-deps
11:46:47 AM: Search for the keywords to learn more about each error.
The (simple) solution here was to remove
/*eslint-disable react-hooks/exhaustive-deps */
from the files list above (I say simple because there is likely more to it than that.)
As mentioned in my last post, you need to upgrade react-scripts to 5.0.0 for it to work. The issue as I understand it with react-scripts@4.0.0 which is currently listed as a dependency in the package.json.
I finally deployed!!
What I last did is, I deleted the below sentence,
/*eslint-disable react-hooks/exhaustive-deps */
I changed the version of react-scripts to 5.0.0. then finally deployed!! Thank you so much for your patient and support! I really appreciate it!!