入手react的 第一坑
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@9.8.1
npm info using node@v18.17.1
npm verb title npm install react react-dom react-scripts cra-template
npm verb argv "install" "--no-audit" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/Users/csy/.npm/_logs/2023-08-11T08_10_08_772Z-
npm verb logfile /Users/csy/.npm/_logs/2023-08-11T08_10_08_772Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/react 4118ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/react-dom 2255ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/react-scripts 10ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/react 1417ms (cache miss)
npm verb stack Error: unable to resolve dependency tree
npm verb stack at #failPeerConflict (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1376:25)
npm verb stack at #loadPeerSet (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1342:33)
npm verb stack at async #buildDepStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:917:11)
npm verb stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:196:7)
npm verb stack at async Promise.all (index 1)
npm verb stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:159:5)
npm verb stack at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:149:5)
npm verb stack at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5)
npm verb cwd /Users/yc/code/my-app
npm verb Darwin 21.6.0
npm verb node v18.17.1
npm verb npm v9.8.1
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@0.1.0
npm ERR! Found: react@undefined
npm ERR! node_modules/react
npm ERR! react@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@">= 16" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"*" from the root project
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!
初始化都失败了,报错事依赖问题,结果看了半天是执行权限的问题,加上sudo就好了。