설치하려고 하는데나트륨 오리지널OpenBSD 7.3 amd64의 npm 패키지로.
내레이터: 종속성으로하이퍼코어, 하이퍼비, 코어스토어.
이것이 필요하다노드집.
다음과 같은이것, C 및 C++ 컴파일러를 clang으로 설정했습니다.
export CC=clang
export CXX=clang++
디렉토리를 생성 example
하고 개발/디버깅을 위해 chmod 777
.
npm init
그런 다음 빈 파일을 만들곤 했습니다 package.json
.
을(를 ) 실행할 때 npm install sodium-native
다음 오류 로그가 나타납니다.
395 info run [email protected] install node_modules/sodium-native node-gyp-build
396 info run [email protected] install { code: 1, signal: null }
397 timing reify:rollback:createSparse Completed in 4183ms
398 timing reify:rollback:retireShallow Completed in 0ms
399 timing command:install Completed in 31258ms
400 verbose stack Error: command failed
400 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
400 verbose stack at ChildProcess.emit (node:events:513:28)
400 verbose stack at maybeClose (node:internal/child_process:1091:16)
400 verbose stack at Socket.<anonymous> (node:internal/child_process:449:11)
400 verbose stack at Socket.emit (node:events:513:28)
400 verbose stack at Pipe.<anonymous> (node:net:322:12)
401 verbose pkgid [email protected]
402 verbose cwd /example
403 verbose OpenBSD 7.3
404 verbose node v18.15.0
405 verbose npm v9.5.0
406 error code 1
407 error path /example/node_modules/sodium-native
408 error command failed
409 error command sh -c node-gyp-build
410 error gyp info it worked if it ends with ok
410 error gyp info using [email protected]
410 error gyp info using [email protected] | openbsd | x64
410 error gyp info find Python using Python version 3.10.11 found at "/usr/local/bin/python3"
410 error gyp info spawn /usr/local/bin/python3
410 error gyp info spawn args [
410 error gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
410 error gyp info spawn args 'binding.gyp',
410 error gyp info spawn args '-f',
410 error gyp info spawn args 'make',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/example/node_modules/sodium-native/build/config.gypi',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
410 error gyp info spawn args '-I',
410 error gyp info spawn args '/root/.cache/node-gyp/18.15.0/include/node/common.gypi',
410 error gyp info spawn args '-Dlibrary=shared_library',
410 error gyp info spawn args '-Dvisibility=default',
410 error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.15.0',
410 error gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
410 error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.15.0/<(target_arch)/node.lib',
410 error gyp info spawn args '-Dmodule_root_dir=/example/node_modules/sodium-native',
410 error gyp info spawn args '-Dnode_engine=v8',
410 error gyp info spawn args '--depth=.',
410 error gyp info spawn args '--no-parallel',
410 error gyp info spawn args '--generator-output',
410 error gyp info spawn args 'build',
410 error gyp info spawn args '-Goutput_dir=.'
410 error gyp info spawn args ]
410 error node:events:491
410 error throw er; // Unhandled 'error' event
410 error ^
410 error
410 error Error: write EPIPE
410 error at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
410 error Emitted 'error' event on Socket instance at:
410 error at Socket.onerror (node:internal/streams/readable:785:14)
410 error at Socket.emit (node:events:513:28)
410 error at emitErrorNT (node:internal/streams/destroy:151:8)
410 error at emitErrorCloseNT (node:internal/streams/destroy:116:3)
410 error at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
410 error errno: -32,
410 error code: 'EPIPE',
410 error syscall: 'write'
410 error }
410 error
410 error Node.js v18.15.0
410 error gyp: Call to 'node deps/bin.js --print-include' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
410 error gyp ERR! configure error
410 error gyp ERR! stack Error: `gyp` failed with exit code: 1
410 error gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:325:16)
410 error gyp ERR! stack at ChildProcess.emit (node:events:513:28)
410 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
410 error gyp ERR! System OpenBSD 7.3
410 error gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
410 error gyp ERR! cwd /example/node_modules/sodium-native
410 error gyp ERR! node -v v18.15.0
410 error gyp ERR! node-gyp -v v9.3.1
410 error gyp ERR! not ok
411 verbose exit 1
412 timing npm Completed in 31440ms
413 verbose unfinished npm timer reify 1683196282136
414 verbose unfinished npm timer reify:build 1683196305333
415 verbose unfinished npm timer build 1683196305334
416 verbose unfinished npm timer build:deps 1683196305334
417 verbose unfinished npm timer build:run:install 1683196305349
418 verbose unfinished npm timer build:run:install:node_modules/sodium-native 1683196307572
419 verbose code 1
420 error A complete log of this run can be found in:
420 error /root/.npm/_logs/2023-05-04T10_31_22_018Z-debug-0.log
node_modules 디렉터리가 생성되지 않습니다. 이것을 어떻게 설명해야 할지 모르겠습니다. 이것이 권한 문제인지, 컴파일러 툴체인 문제인지, 아니면 다른 문제인지 잘 모르겠습니다.
여기서 무엇이 잘못될 수 있나요? 다음에는 어떤 조치를 취하면 되나요?
편집하다: 추가 조사:
문제는 다음과 같이 더 직접적으로 재현될 수 있습니다.
pkg_add git
git clone --branch v3.3.0 https://github.com/sodium-friends/sodium-native
pkg_add node
cd s*
node deps/bin.js --print-include --print-lib --print-arch
console.log
s in을 사용하면 deps/bin.js
프로세스 객체에 생성된 소켓 관련 문제가 좁혀집니다.실행 기능, 'tar' 및 'xzv' 매개변수를 전달할 때(https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz);언제소켓 사이에 파이프를 시도합니다.. 나는 보았다이것, OpenBSD가 소켓을 조기에 닫을 수 있는 이유가 있는지 궁금하십니까?
아마도 관련 링크:
https://stackoverflow.com/questions/39739626/what-is-node-gyp https://stackoverflow.com/questions/58436786/build-of-sodium-native-on-centos-cloud-is-failing https://stackoverflow.com/questions/39855232/npm-install-fails-with-node-gyp-build-error https://github.com/prebuild/node-gyp-build/issues/8
https://github.com/nodejs/node-gyp/issues/809
답변1
버전 3.2.1은 다음과 같이 설치할 수 있습니다.
npm i [email protected]
그 전에는 다음을 수행했습니다(위의 경우 이것이 필요한지 확실하지 않음).
pkg_add git
git clone --branch v3.2.1 https://github.com/sodium-friends/sodium-native
cd s*
pkg_add libsodium
pkg_add libtool
pkg_add autoconf
export AUTOCONF_VERSION=2.71 #choose your version
pkg_add automake
export AUTOMAKE_VERSION=1.16 #choose your version
npm install
npm test # check it installed ok
이 절반 솔루션은 업스트림 나트륨 일반 모듈 및 하이퍼코어 모듈과 함께 사용할 때 오류를 일으키는 모듈을 제공합니다.