諸è¬ã®äºæ ã§ãããã®ã¬ã³ã¿ã«ãµã¼ãä¸ã§ Node.js (npm) ã使ããããªã£ãã®ã§ã調ã¹ããã¨ãã¤ã³ã¹ãã¼ã«æé ãæ®ãã¦ããã
åæ:
- 2022å¹´5ææç¹ã®æ å ±
- ãããã®ã¬ã³ã¿ã«ãµã¼ãã§ã¯Node.js (npm) ã¯æä¾ãã¦ããªã (ã®ã§ä½¿ããããã«ãããã¨ãå«ãã¦ãã¹ã¦èªå·±è²¬ä»»)
é¸æè¢
(1) ããã±ã¼ã¸ããã¼ã¸ã£ã§Node.jsãã¤ã³ã¹ãã¼ã«ãã
ãããã®ã¬ã³ã¿ã«ãµã¼ãã¯FreeBSDã¨ããOSã使ããã¦ãã¦ãFreeBSDã§ã¯ããã±ã¼ã¸ããã¼ã¸ã£ã¨ã㦠packages
㨠ports
ã使ãããããã
[pinkumohikan ~]$ uname -s FreeBSD
https://docs.freebsd.org/ja/books/handbook/ports/
ãããã®ã¬ã³ã¿ã«ãµã¼ãã¯ãããã "ã¬ã³ã¿ã«ãµã¼ã" ãªã®ã§ãããã±ã¼ã¸ãã°ãã¼ãã«ã¤ã³ã¹ãã¼ã«ããã®ã«å¿ è¦ãªroot権é㯠(å½ç¶) å©ç¨è ã«ã¯ä¸ãããã¦ããªãããã®ããããã±ã¼ã¸ããã¼ã¸ã£ãå©ç¨ãã¦Node.jsãã¤ã³ã¹ãã¼ã«ãããã¨ã¯åºæ¥ãªãã
(2) ãã¤ããªããã¦ã³ãã¼ããã¦ä½¿ã
macOSãLinuxçã®ã¡ã¸ã£ã¼OSç¨ã®ãã¤ããªã¯å ¬éããã¦ããããFreeBSDç¨ã®å ¬å¼Node.jsãã¤ããªã¯é å¸ããã¦ãªãã£ãã
https://nodejs.org/ja/download/
(3) ãã¤ããªãã³ã³ãã¤ã«ãã¦ä½¿ã
Node.jsã¯OSSãªã®ã§ã½ã¼ã¹ã³ã¼ããå ¬éããã¦ããã
https://github.com/nodejs/node
ã³ã³ãã¤ã«ã«å¿ è¦ãªã¢ã¬ã³ã¬ (gccã¨ã) ã¯ãããã®ã¬ã³ã¿ã«ãµã¼ãã¸ã¤ã³ã¹ãã¼ã«ããã¦ããã®ã§ãNode.jsã®ã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ããã¦èªåã§ã³ã³ãã¤ã«ãããã¨ã§Node.js (npm) ã使ããã¨ãã§ãããã
Node.jsã®ã¤ã³ã¹ãã¼ã«
ä»åã¯ã(3) ãã¤ããªãã³ã³ãã¤ã«ãã¦ä½¿ããã®æ¹æ³ã§Node.jsã使ããããã«ãã¦ããã
(1) OpenSSLãã³ã³ãã¤ã«ãã
æ¨æºã§ä½¿ããOpenSSLã¯ãã¼ã¸ã§ã³ãå¤ãã¦Node.jsã®ãã«ãã«ä½¿ããªã (â») ãããæ°ãããªOpenSSLããã¦ã³ãã¼ã & ã³ã³ãã¤ã«ããã
[pinkumohikan ~/openssl]$ curl -sSf https://www.openssl.org/source/openssl-1.1.1o.tar.gz -O [pinkumohikan ~/openssl]$ tar zxf openssl-1.1.1o.tar.gz [pinkumohikan ~/openssl-1.1.1o]$ ./config --prefix=/home/pinkumohikan/openssl --openssldir=/home/pinkumohikan/local/openssl [pinkumohikan ~/openssl-1.1.1o]$ make [pinkumohikan ~/openssl-1.1.1o]$ make install
(2) Node.jsãã³ã³ãã¤ã«ãã
2022å¹´5ææç¹ã®æ¨å¥¨LTSã¯Node.js 16ç³»ã ããNode.js 16ããPython 3å¿ é ã«ãªãåé¡ (â») ããã£ã¦é½åãæªãã®ã§ä»åã¯Node.js 14ã使ããã¨ã«ããã
https://nodejs.org/ja/download/
[pinkumohikan ~]$ curl -sSf https://nodejs.org/dist/v14.9.0/node-v14.9.0.tar.gz -O [pinkumohikan ~]$ tar zxf node-v14.9.0.tar.gz [pinkumohikan ~/node-v14.9.0]$ ./configure --shared-openssl --shared-openssl-includes=/home/pinkumohikan/openssl/include/ --shared-openssl-libpath=/home/pinkumohikan/openssl/lib/ Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'virtual:world', not found Node.js configure: Found Python 2.7.18... INFO: configure completed successfully
[pinkumohikan ~/node-v14.9.0]$ export LD_LIBRARY_PATH=/home/pinkumohikan/openssl/lib [pinkumohikan ~/node-v14.9.0]$ nohup make install DESTDIR=/home/pinkumohikan/local PREFIX=
make install
ã«ã¯æ°ååãããã®ã§ã³ãã¯ã·ã§ã³åæã«åãã¦nohupã¤ãã¦ããã®ããªã¹ã¹ã¡ã
(3) Pathãéã
ã¢ããã§ããããã¨ã¯ãã¹ãéãã ãã
[pinkumohikan ~/node-v14.9.0]$ echo "export PATH=$PATH:~/local/bin export LD_LIBRARY_PATH=/home/pinkumohikan/openssl/lib" >> .bashrc
ãã°ã¤ã³ãç´ãã source .bashrc
ãã¦
[pinkumohikan ~]$ node -v v14.9.0 [pinkumohikan ~]$ npm -v 6.14.8
å®ã
åè
OpenSSLãå¤ãã¦Node.jsã®ã³ã³ãã¤ã«ã«ä½¿ããªãåé¡
æ¨æºã®OpenSSLãå©ç¨ãã¦Node.jsãã³ã³ãã¤ã«ãããã¨ããã¨ä¸è¨ã®ãããªã¨ã©ã¼ãåºãã
[pinkumohikan ~/node-v14.9.0]$ make ... ../src/node_crypto.h:72:46: error: use of undeclared identifier 'EVP_MD_CTX_free'; did you mean 'EVP_MD_CTX_create'? using EVPMDPointer = DeleteFnPtr<EVP_MD_CTX, EVP_MD_CTX_free>; ^~~~~~~~~~~~~~~ EVP_MD_CTX_create
[pinkumohikan ~]$ openssl version OpenSSL 1.0.2o-freebsd 27 Mar 2018
GitHub Issueã軽ãèªãã æãOpenSSLãå¤ããããããã
https://github.com/nodejs/node/issues/22025
Node.js 16ããPython 3å¿ é ã«ãªãåé¡
ãããã®ã¬ã³ã¿ã«ãµã¼ãã§ã¯Python 2ç³»ã¾ã§ãã使ããªãã®ã§ãPython 3ç³»ãå¿ é ã¨ãªãNode.js 16ç³»ã¯å ¥ããããªãã
[pinkumohikan ~/node-v16.15.0]$ ./configure Node.js configure: Found Python 2.7.18... Please use python3.10 or python3.9 or python3.8 or python3.7 or python3.6.
Node.js 14ç³»ã¾ã§ãªãPython 2ç³»ã§ãããã
ãã ãPython 3ãèªåã³ã³ãã¤ã«ããã°Node.js 16ç³»ããããããªæ°ãããã®ã§èª°ã試ãã¦ã¿ã¦æ¬²ããã
https://www.python.org/downloads/
åèã«ããè³æ
- OpenSSLã error while loading shared libraries libssl.so.1.1
- https://kaworu.jpn.org/security/OpenSSL%E3%81%8C_error_while_loading_shared_libraries_libssl.so.1.1
- ãã«ãå¾
node
ã³ãã³ãå®è¡æã«ãlibssl.so.1.1è¦ã¤ãããã®ãããã£ã¦æãããã¨ãã«åèã«ãªã£ã
- å ±æã©ã¤ãã©ãªã®ç¢ºèª(ldd)ã¨è¨å®(ldconfig)
- ãã£ããnohupç¡ãã§é·æéãããã³ãã³ããå®è¡ããã¨ãã«å¾ããçµäºããªãããã«ãã
- https://blog.glidenote.com/blog/2013/09/26/bg-and-disown/
- åå¹´ã«ä¸åããããã®è¨äºèªã¿ã«è¡ã£ã¦ã (ããå æ¸è¦ãã)
- How to build native addon against their own version of OpenSSL - Ignoring Node.js shipped OpenSSL #1724