lx-music-mobile
lx-music-mobile copied to clipboard
【Issue】使用macOS系统在npm install时报错
使用华为npm镜像也会报错,查资料尝试了一下午也没解决,求大佬帮忙分析下原因
node -v
v18.4.0
npm -v
8.13.1
具体报错信息如下:
npm install
npm WARN skipping integrity check for git dependency ssh://[email protected]/lyswhut/react-native-track-player.git
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: support for ECMAScript is superseded by uglify-js as of v3.13.0
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm ERR! code 127
npm ERR! git dep preparation failed
npm ERR! command /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/achamps/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > [email protected] prepare
npm ERR! > yarn build
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN ERESOLVE overriding peer dependency
npm ERR! npm WARN While resolving: [email protected]
npm ERR! npm WARN Found: [email protected]
npm ERR! npm WARN node_modules/react
npm ERR! npm WARN peer react@">=16.8.6" from the root project
npm ERR! npm WARN 2 more (react-native, use-sync-external-store)
npm ERR! npm WARN
npm ERR! npm WARN Could not resolve dependency:
npm ERR! npm WARN peer react@"^16.0.0 || ^17.0.0" from [email protected]
npm ERR! npm WARN node_modules/react-shallow-renderer
npm ERR! npm WARN react-shallow-renderer@"16.14.1" from [email protected]
npm ERR! npm WARN node_modules/react-native
npm ERR! npm WARN
npm ERR! npm WARN Conflicting peer dependency: [email protected]
npm ERR! npm WARN node_modules/react
npm ERR! npm WARN peer react@"^16.0.0 || ^17.0.0" from [email protected]
npm ERR! npm WARN node_modules/react-shallow-renderer
npm ERR! npm WARN react-shallow-renderer@"16.14.1" from [email protected]
npm ERR! npm WARN node_modules/react-native
npm ERR! npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated [email protected]: support for ECMAScript is superseded by uglify-js as of v3.13.0
npm ERR! npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm ERR! npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm ERR! /var/folders/zh/5_wfw9nd45d4wdrtqct2rl640000gn/T/prepare-1656147978180.sh: line 2: yarn: command not found
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /Users/achamps/.npm/_cacache/tmp/git-cloneWrL4m7
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c /var/folders/zh/5_wfw9nd45d4wdrtqct2rl640000gn/T/prepare-1656147978180.sh
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/achamps/.npm/_logs/2022-06-25T09_03_42_281Z-debug-0.log
试试将 npm 降回8.5:npm i [email protected] -g
试试将 npm 降回8.5:
npm i [email protected] -g降级失败,报错信息和上面的一样,你使用的node版本号是多少,我重装一下和你一样版本的node试试
https://github.com/lyswhut/lx-music-mobile/blob/6832e11fdf59adfc31dbe4b919de17b6c89ce24f/.github/workflows/release.yml#L19
https://github.com/lyswhut/lx-music-mobile/blob/6832e11fdf59adfc31dbe4b919de17b6c89ce24f/.github/workflows/release.yml#L45
再不行的话就是你环境的问题了,尝试进行清理/验证缓存之类的操作
https://github.com/lyswhut/lx-music-mobile/blob/6832e11fdf59adfc31dbe4b919de17b6c89ce24f/.github/workflows/release.yml#L19
https://github.com/lyswhut/lx-music-mobile/blob/6832e11fdf59adfc31dbe4b919de17b6c89ce24f/.github/workflows/release.yml#L45
再不行的话就是你环境的问题了,尝试进行清理/验证缓存之类的操作
好的,我试试,谢谢!
在系统根目录执行 npm install yarn成功之后,项目路径下的package.json中自动加入了 "yarn": "^1.22.19",再在项目路径下执行npm install就好了