m1 上使用nvm
以下node的版本可以直接下載(Binary download,而不是 trying source)而不用切換mac cpu架構(gòu)
zhiwenwen@zhiwenwendeMBP cockpit % nvm install 14.15.5
Downloading and installing node v14.15.5...
Downloading https://nodejs.org/dist/v14.15.5/node-v14.15.5-darwin-x64.tar.xz...
################################################################################################################################### 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v14.15.5 (npm v6.14.11)
經(jīng)測(cè)試上述使用nvm直接下載的node Binary ,可以下載對(duì)應(yīng)的node-sass版本不會(huì)報(bào)錯(cuò),但是如果上述版本下載的source類似下面,那么再去下載對(duì)應(yīng)的node-sass版本會(huì)報(bào)錯(cuò)
那么我們?nèi)绾卧趎ode上使用nvm下載node不去下載source呢?
見(jiàn)下文
? sales_app git:(carDetail) nvm install 12.22.12
Downloading and installing node v12.22.12...
Downloading https://nodejs.org/dist/v12.22.12/node-v12.22.12-darwin-arm64.tar.xz...
-#O=-# # #
curl: (22) The requested URL returned error: 404
Binary download from https://nodejs.org/dist/v12.22.12/node-v12.22.12-darwin-arm64.tar.xz failed, trying source.
grep: /Users/gch/.nvm/.cache/bin/node-v12.22.12-darwin-arm64/node-v12.22.12-darwin-arm64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Local cache found: $NVM_DIR/.cache/src/node-v12.22.12/node-v12.22.12.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/src/node-v12.22.12/node-v12.22.12.tar.xz
$>./configure --prefix=/Users/gch/.nvm/versions/node/v12.22.12 <
INFO: configure completed successfully
/Library/Developer/CommandLineTools/usr/bin/make -C out BUILDTYPE=Release V=0
touch /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/node_dtrace_header.stamp
touch /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/specialize_node_d.stamp
touch /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/tools/v8_gypfiles/v8_headers.stamp
c++ -o /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/icui18n/deps/icu-small/source/i18n/nultrans.o ../deps/icu-small/source/i18n/nultrans.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DU_I18N_IMPLEMENTATION=1' '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -O3 -gdwarf-2 -mmacosx-version-min=10.10 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-exceptions -fno-strict-aliasing -MMD -MF /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/.deps//Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/icui18n/deps/icu-small/source/i18n/nultrans.o.d.raw -c
c++ -o /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/icui18n/deps/icu-small/source/i18n/uspoof_conf.o ../deps/icu-small/source/i18n/uspoof_conf.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DU_I18N_IMPLEMENTATION=1' '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -O3 -gdwarf-2 -mmacosx-version-min=10.10 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-exceptions -fno-strict-aliasing -MMD -MF /Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/.deps//Users/gch/.nvm/.cache/src/node-v12.22.12/files/out/Release/obj.target/icui18n/deps/icu-small/source/i18n/uspoof_conf.o.d.raw -c
經(jīng)過(guò)分析發(fā)現(xiàn)命令安裝node版本時(shí),M1電腦自動(dòng)拼接路徑如下:
https://nodejs.org/dist/v12.22.12/node-v12.22.12-darwin-arm64.tar.xz
arm64是M1特有的軟件命令方式 目前node官網(wǎng)不提供此類的壓縮包壓縮包官網(wǎng)
解決方案
執(zhí)行install命令前先執(zhí)行M1兼容命令:arch -x86_64 zsh
然后再執(zhí)行install會(huì)自動(dòng)修復(fù)下載版本的鏈接:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-617851.html
? ~ arch -x86_64 zsh
? ~ nvm install 12.22.0
Downloading and installing node v12.22.0...
Downloading https://nodejs.org/dist/v12.22.0/node-v12.22.0-darwin-x64.tar.xz...
###################################################################################################### 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v12.22.0 (npm v6.14.11)
注:使用 arch -arm64 zsh
切換為arm架構(gòu);顯示當(dāng)前主機(jī)硬件架構(gòu)類型 使用arch命令;查看當(dāng)前arch版本命令使用 arch --version文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-617851.html
到了這里,關(guān)于mac使用mvn下載node-sass 會(huì)Binary download failed, trying source的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!