无法在 M1 Mac 上安装 bcrypt - Apple Silicon
Failed to install bcrypt on M1 Mac - Apple Silicon
我无法在我的项目中安装 bcrypt 包。
我的朋友克隆了我项目的完全相同的 repo,它对他有用。
我已经讨论了一些关于 python 或 node-gyp 可能与此问题有关的讨论。
我不知道它是否有帮助,但我有 :
node v16.13.0
8.1.4
Mac M1,macOS Monterey 版本 12.0.1
我也做了一个npm cache clean --force
我在尝试安装 bcrypt 5.0.1 时收到此消息:
yinkyflash@Air-de-Tom backend % npm install bcrypt
npm ERR! code 1
npm ERR! path /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR! LIBTOOL-STATIC Release/nothing.a
npm ERR! CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.7
npm ERR! node-pre-gyp info using node@16.13.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.13.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.9 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yinkyflash/Library/Caches/node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/yinkyflash/Library/Caches/node-gyp/16.13.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/yinkyflash/Library/Caches/node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! clang: error: no such file or directory: '6/Livrables/TomCharmasson_6_27052021/backend/node_modules/node-addon-api'
npm ERR! make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.1.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v8.4.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.1.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! node-pre-gyp ERR! node -v v16.13.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.7
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yinkyflash/.npm/_logs/2021-11-29T16_10_26_275Z-debug.log
M1 Mac 的 Bcrypt 解决方案
最有可能的问题是您的路径包含 space 或特殊字符。据我所知,Project 6
有一个 space 尝试将您的项目移动到没有 space 的某个地方,或者将 space 重命名为 -
,这解决了我的问题M1 Pro mac 在我的情况下有完全相同的问题我的路径中有 -=Projects=-
作为导致问题的文件夹名称。
之前的解决方案对我不起作用,一个简单的解决方案可能是使用 yarn 而不是 npm
yarn add bcrypt
我无法在我的项目中安装 bcrypt 包。
我的朋友克隆了我项目的完全相同的 repo,它对他有用。
我已经讨论了一些关于 python 或 node-gyp 可能与此问题有关的讨论。
我不知道它是否有帮助,但我有 :
node v16.13.0
8.1.4
Mac M1,macOS Monterey 版本 12.0.1
我也做了一个npm cache clean --force
我在尝试安装 bcrypt 5.0.1 时收到此消息:
yinkyflash@Air-de-Tom backend % npm install bcrypt
npm ERR! code 1
npm ERR! path /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR! LIBTOOL-STATIC Release/nothing.a
npm ERR! CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.7
npm ERR! node-pre-gyp info using node@16.13.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.13.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.9 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/yinkyflash/Library/Caches/node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/yinkyflash/Library/Caches/node-gyp/16.13.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/yinkyflash/Library/Caches/node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.0
npm ERR! gyp info using node@16.13.0 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! clang: error: no such file or directory: '6/Livrables/TomCharmasson_6_27052021/backend/node_modules/node-addon-api'
npm ERR! make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.1.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v8.4.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.1.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/yinkyflash/Desktop/Programming/OpenClassrooms/Projet 6/Livrables/TomCharmasson_6_27052021/backend/node_modules/bcrypt
npm ERR! node-pre-gyp ERR! node -v v16.13.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.7
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yinkyflash/.npm/_logs/2021-11-29T16_10_26_275Z-debug.log
M1 Mac 的 Bcrypt 解决方案
最有可能的问题是您的路径包含 space 或特殊字符。据我所知,Project 6
有一个 space 尝试将您的项目移动到没有 space 的某个地方,或者将 space 重命名为 -
,这解决了我的问题M1 Pro mac 在我的情况下有完全相同的问题我的路径中有 -=Projects=-
作为导致问题的文件夹名称。
之前的解决方案对我不起作用,一个简单的解决方案可能是使用 yarn 而不是 npm
yarn add bcrypt