1

When I run npm install I get the following error below and I don't have an idea how I could fix it. I tried digging into that error log to resolve those dependencies but all not no avail. I will appreciate any lead to resolve this problem. It is my React first code. Thanks in anticipation!

Error Log

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @babel/core@7.2.2
npm ERR! node_modules/@babel/core
npm ERR!   @babel/core@"7.2.2" from react-scripts@2.1.8
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"^2.1.3" from the root project
npm ERR!     peer react-scripts@">=2.1.3" from react-app-rewired@2.1.8
npm ERR!     node_modules/react-app-rewired
npm ERR!       react-app-rewired@"^2.1.0" from the root project
npm ERR!   @babel/core@"^7.1.6" from @svgr/webpack@4.1.0
npm ERR!   node_modules/@svgr/webpack
npm ERR!     @svgr/webpack@"4.1.0" from react-scripts@2.1.8
npm ERR!     node_modules/react-scripts
npm ERR!       react-scripts@"^2.1.3" from the root project
npm ERR!       1 more (react-app-rewired)
npm ERR!   8 more (babel-core, babel-loader, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @babel/core@"^7.13.0" from @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12
npm ERR! node_modules/@babel/preset-env/node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining
npm ERR!   @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@"^7.13.12" from @babel/preset-env@7.14.1
npm ERR!   node_modules/@babel/preset-env
npm ERR!     @babel/preset-env@"^7.1.6" from @svgr/webpack@4.1.0
npm ERR!     node_modules/@svgr/webpack
npm ERR!       @svgr/webpack@"4.1.0" from react-scripts@2.1.8
npm ERR!       node_modules/react-scripts
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/tiwa/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tiwa/.npm/_logs/2021-05-11T18_39_17_361Z-debug.log

package.json

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.0.0",
    "eslint": "^6.0.1",
    "ipfs-api": "^26.1.2",
    "json-loader": "^0.5.7",
    "node-sass": "^4.11.0",
    "react": "^16.8.6",
    "react-app-rewired": "^2.1.0",
    "react-bootstrap": "^1.0.0-beta.5",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.0",
    "react-scripts": "^2.1.3",
    "react-toggle": "^4.0.2",
    "rimble-ui": "^0.7.0",
    "styled-components": "^4.1.3",
    "web3": "1.0.0-beta.37",
    "zeppelin-solidity-hot-loader": "^1.2.3"
  },
  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {}
}

npm version

7.0.8

node version

v15.2.1

Log File

GNU nano 2.0.6                                                 
File: /Users/tiwa/.npm/_logs/2021-05-12T10_58_57_849Z-debug.log                                                                                                          

0 verbose cli [
0 verbose cli   '/Users/tiwa/.asdf/installs/nodejs/15.2.1/bin/node',
0 verbose cli   '/Users/tiwa/.asdf/installs/nodejs/15.2.1/bin/npm',
0 verbose cli   'run',
0 verbose cli   'client'
0 verbose cli ]
1 info using npm@7.0.8
2 info using node@v15.2.1
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:/Users/tiwa/.asdf/installs/nodejs/15.2.1/lib/node_modules/npm/npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/Users/tiwa/WebstormProjects/nft/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/Users/tiwa/.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:/Users/tiwa/.asdf/installs/nodejs/15.2.1/.npm/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 3ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 13ms
19 verbose npm-session ed61a70477c00f22
20 timing npm:load Completed in 23ms
21 timing command:run-script Completed in 34358ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/Users/tiwa/.asdf/installs/nodejs/15.2.1/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:329:20)
22 verbose stack     at maybeClose (node:internal/child_process:1055:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
23 verbose pkgid NFT-based-photo-marketplace@1.0.0
24 verbose cwd /Users/tiwa/WebstormProjects/nft
25 verbose Darwin 20.3.0
26 verbose argv "/Users/tiwa/.asdf/installs/nodejs/15.2.1/bin/node" "/Users/tiwa/.asdf/installs/nodejs/15.2.1/bin/npm" "run" "client"
27 verbose node v15.2.1
28 verbose npm  v7.0.8
29 error code 1
30 error path /Users/tiwa/WebstormProjects/nft
31 error command failed
32 error command sh -c cd client && npm run start
Afolabi Olaoluwa
  • 1,898
  • 3
  • 16
  • 37

4 Answers4

0

Have you tried removing node_modules/ and package-lock.js and then run npm install command?

0

npm 7 requires peer dependencies to be installed when most React projects still declare this as optional.

You can install using npm i --legacy-peer-deps or set this in your .npmrc:

npm set config legacy-peer-deps=true
m90
  • 11,434
  • 13
  • 62
  • 112
0

are you sure, you are doing npm install in the correct folder? First cd into the correct folder in the terminal where you need to install and then run below command -

npm ci
Nishant Kumar
  • 691
  • 1
  • 11
  • 31
  • Why are you wanting to run a CI install? That command should only be used for continuous-integration services. – 0xLogN May 11 '21 at 21:59
  • @LoganDevine To automatically remove the previous node_modules and do a fresh clean install. If a node_modules is already present, it will be automatically removed before npm ci begins its install. – Nishant Kumar May 12 '21 at 21:30
  • But it will error for an outdated package-lock; usually you do `rm -rf node_modules && npm i` – 0xLogN May 12 '21 at 23:51
0

Generally, I've found that yarn provides better info than npm in case of an error. Could you possibly share a (gist) link to /Users/tiwa/.npm/_logs/2021-05-11T18_39_17_361Z-debug.log?

Ezra Obiwale
  • 1,756
  • 1
  • 12
  • 15