-
pkg로 만든 exe가 Error: No native build was found for ....개발실/Web 2021. 2. 21. 23:50반응형
nodejs에서 실행되는 코드를 pkg를 이용해서 exe로 만들고,
해당 exe를 실행했더니, 아래와 같은 에러가 나서 해결한 내용임.
pkg/prelude/bootstrap.js:1244 throw error; ^ Error: No native build was found for platform=win32 arch=x64 runtime=node abi=64 uv=1 libc=glibc node=10.21.0 loaded from: D:\svn\WorldStudio\RpcServer\Cm.RpcServerJs\bin at Function.load.path (D:\snapshot\Cm.RpcServerJs\node_modules\node-gyp-build\index.js:59:9) at load (D:\snapshot\Cm.RpcServerJs\node_modules\node-gyp-build\index.js:21:30) at Object.<anonymous> (D:\snapshot\Cm.RpcServerJs\node_modules\zeromq\lib\native.js:6:43) at Module._compile (pkg/prelude/bootstrap.js:1320:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:651:32) at tryModuleLoad (internal/modules/cjs/loader.js:591:12) at Function.Module._load (internal/modules/cjs/loader.js:583:3) at Module.require (internal/modules/cjs/loader.js:690:17) at Module.require (pkg/prelude/bootstrap.js:1225:31) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (D:\snapshot\Cm.RpcServerJs\node_modules\zeromq\lib\index.js:3:16) at Module._compile (pkg/prelude/bootstrap.js:1320:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:651:32) at tryModuleLoad (internal/modules/cjs/loader.js:591:12)- nodejs에 프로그램을 만들어서 VSCode를이용해서 열심히 실행하고 테스트잘되서,
- pkg 삽질해서 딱하고 exe를 만듬. exe도 잘실행됨.
- 이후, zeromq라는 module을 npm을 통해서 추가하고 기능을 추가하고, VSCode를 통해서 잘실행됨.
- pkg를 통해서 빌드하니 아래와 같은 경고가 뜸.
> pkg . --out-path bin > pkg@4.4.9 > Targets not specified. Assuming: node14-linux-x64, node14-macos-x64, node14-win-x64 > Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules\zeromq\prebuilds %2: path-to-executable/prebuilds > Warning Cannot include directory %1 into executable. The directory must be distributed with executable as %2. %1: node_modules\zeromq\prebuilds %2: path-to-executable/prebuilds- 에러가 아니니 그냥 가볍게 넘기고, exe도 생성이 되었길래 실행을 하니 오류가 남. ( 에러 내용은 위에 )
- 처음에는 node 버전 10버전대가 안맞는가 싶어. node도 최신(14)을 설치해보고.
- 다음으로 기타 인터넷 서치하면서 module들 다시 설치해보고 계속 같은 증상나옴.
- 그러다, 결정적인 내용을 만남 blog.outsider.ne.kr/1381
pkg로 바이너리를 컴파일할 때 Native 애드온을 같이 사용할 때의 오류 :: Outsider's Dev Story
며칠 전에 [pkg](https://github.com/zeit/pkg)로 [Node.js를 하나의 파일로 패키징하는 방법](https://blog.outsider.ne.kr/1379)에 관한 글을 썼는데 pkg를 사용할 때 주의할 점이 있다. Node.js는 크게 JavaS...
blog.outsider.ne.kr
- 핵심은 c,c++로되어 있는 모듈들은 컴파일하게 되는데, pkg의 기능이 완전치 않아서 부가 정보파일을 exe폴더에 같이 배포해줘야 한다는것임
- 그래서, 위 2번째 경고에 있는데로 prebuilds 폴더를 exe가 있는 폴더에 놓아도 똑같은 에러가 남.
- 몇가지 더 삽질하다가, pkg의 output으로 windows버전만 나오게 하던걸, 지우고 모든 운영체제 다나오게 하고.
- pkg의 targets도 node10 ->node12로 바꾸고
- 다시 pkg를 하니 열심히 먼가를 다운받고 빌드하고 경고는 위 2번째하고 똑같이 나옴.
- 그리고, prebuilds 폴더를 다시 exe가 있는 폴더에 놓으니, 짠하고 실행됨.
ㅡㅡ;
반응형'개발실 > Web' 카테고리의 다른 글
Asp.Net, Asp.Net Core 차이? (0) 2023.02.07