>大家,就在从GitHub克隆Hyperledger Cactus项目之后,当运行'npm run configure'时,我遇到了以下错误。
机器配置:
- 苹果M1
- 节点版本:16.14.0
- Npm 版本:8.3.1
这是控制台输出:
andre@macbook: cactus [ main ✔ ] » npm run configure
> configure
> yarn install --frozen-lockfile --non-interactive && yarn run build:dev:backend
yarn install v1.18.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info esbuild-android-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-android-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-darwin-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info "esbuild-darwin-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-freebsd-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-32@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-32@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-32@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-arm@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-arm@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-mips64le@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-mips64le@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-mips64le@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-ppc64le@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-ppc64le@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-ppc64le@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-netbsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-netbsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-netbsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-openbsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-openbsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-openbsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-sunos-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-sunos-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-sunos-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-32@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-32@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-32@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/core@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/splash-screen@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/status-bar@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic/angular-toolkit@4.0.0" has unmet peer dependency "@angular-devkit/architect@^0.1200.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic/angular-toolkit@4.0.0" has unmet peer dependency "@angular-devkit/schematics@^12.0.0".
[4/4] Building fresh packages...
[10/40] ⠄ pkcs11js
[2/40] ⠄ electron
[3/40] ⠄ grpc-tools
[6/40] ⠄ secp256k1
error /Users/andre/Documents/cactus/node_modules/grpc-tools: Command failed.
Exit code: 1
Command: node-pre-gyp install
Arguments:
Directory: /Users/andre/Documents/cactus/node_modules/grpc-tools
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.6
node-pre-gyp info using node@16.14.0 | darwin | arm64
node-pre-gyp info check checked for "/Users/andre/Documents/cactus/node_modules/grpc-tools/bin/grpc_tools.node" (not found)
node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
node-pre-gyp ERR! stack at /Users/andre/Documents/cactus/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
node-pre-gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:96:5)
node-pre-gyp ERR! System Darwin 21.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/andre/Documents/cactus/node_modules/grpc-tools/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /Users/andre/Documents/cactus/node_modules/grpc-tools
node-pre-gyp ERR! node -v v16.14.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.6
warning Error running install script for optional dependency: "/Users/andre/Documents/cactus/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/andre/Documents/cactus/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | darwin | arm64
gyp info find Python using Python version 3.9.10 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
gyp http GET https://nodejs.org/download/release/v16.14.0/node-v16.14.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.14.0/node-v16.14.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.14.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.14.0/SHASUMS256.txt
(node:56976) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
gyp info spawn args [
gyp info spawn args '/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/andre/Documents/cactus/node_modules/cpu-features/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/andre/Library/Caches/node-gyp/16.14.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/andre/Library/Caches/node-gyp/16.14.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/andre/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/andre/Documents/cactus/node_modules/cpu-features',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
ACTION Configuring dependencies /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build/Makefile
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build
TOUCH Release/obj.target/config_deps.stamp
ACTION Building dependencies /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a
gmake[1]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[2]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 11%] Building C object CMakeFiles/utils.dir/src/filesystem.c.o
[ 22%] Building C object CMakeFiles/utils.dir/src/stack_line_reader.c.o
[ 33%] Building C object CMakeFiles/utils.dir/src/string_view.c.o
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 33%] Built target utils
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 44%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/hwcaps.c.o
[ 55%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/unix_features_aggregator.c.o
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 55%] Built target unix_based_hardware_detection
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h:118:2: error: "Including cpuinfo_arm.h from a non-arm target."
#error "Including cpuinfo_arm.h from a non-arm target."
^
1 error generated.
gmake[3]: *** [CMakeFiles/cpu_features.dir/build.make:76: CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[2]: *** [CMakeFiles/Makefile2:142: CMakeFiles/cpu_features.dir/all] Error 2
gmake[2]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[1]: *** [Makefile:136: all] Error 2
gmake[1]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
make: *** [/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a] Error 2
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:520:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.2.0
gyp ERR! command "/usr/local/bin/node" "/Users/andre/Documents/cactus/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/andre/Documents/cactus/node_modules/cpu-features
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error
已经尝试安装节点预 gyp,但我认为这可能与 CPU 架构有关。
你有什么建议吗? 提前谢谢你。
@slimas9给出的答案是让我记住这个命令的原因。但是在 m1 mac 上,有一个名为arch
的命令,在这种情况下对您有所帮助,因为它对我也有帮助。
我的问题是节点应用程序中的某些包会尝试运行cpu-features
由于架构和标头问题而无法在我的 m1 mac 上编译
这是一个例子
yarn install
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/2] ⢀ cpu-features
... cut out all the noisy stuff that isn't needed to explain ...
[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/chris/projects/docker-config-gen/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/chris/projects/docker-config-gen/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h:118:2: error: "Including cpuinfo_arm.h from a non-arm target."
#error "Including cpuinfo_arm.h from a non-arm target."
^
1 error generated.
make[3]: *** [CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1
make[2]: *** [CMakeFiles/cpu_features.dir/all] Error 2
所以我记得的是,您可以通过苹果制作的另一个终端命令运行任何终端命令,称为arch
。它的工作原理是让您将任何命令作为参数传递给程序并指定要使用的 arch。所以对于这个有问题的cpu-features
包,我会像这样使用它
arch -x86_64 yarn install
在引擎盖下,arch 将采用 -x86_64 参数并为右侧的命令启用 Rosetta 翻译,这只是yarn install
,但可以是任何命令,arch 将只将其作为子命令执行。纱线安装没有一个投诉。但是,当然,现在您正在运行正在翻译x86_64软件,因此速度会变慢。将来最好尝试再次安装它,而无需arch
帮助查看他们是否解决了cpu-features
的问题并让我在本地运行。但在不久的将来。我的问题解决了!
尝试一下,看看是否有帮助。请记住,将来,您应该再次尝试本机方式,看看他们是否修复了它。因此,您不会浪费 20 小时的电池续航时间来翻译 x86 软件;)