node.js

node.jsはLinux向けにtxzが有るので、展開してpkg化してinstallした。
以前からあったのか?、Linux用の本家バイナリ。https://nodejs.org/en

node-v18.18.0:
https://seesaawiki.jp/lifewithslackarmzaurus_15_0/d/HTML/CSS/JavaScript%a4%ce%ce%fd%bd%ac%20local%20Web%a5%b5%a1%bc%a5%d0%20Node%2ejs を参考に、
https://slackbuilds.org/slackbuilds/14.2/development/nodejs/nodejs.SlackBuild を参考に、
https://slackbuilds.org/slackbuilds/15.0/development/nodejs/nodejs.SlackBuild を参考に、
$ mkdir package-nodejs; cd package-nodejs
$ tar xf ../node-v18.18.0-linux-x64.tar.xz
$ mv -i node-v18.18.0-linux-x64 usr
$ mv -i usr/{CHANGELOG.md,LICENSE,README.md} usr/share/doc/node
$ mv -i usr/lib usr/lib64 (/etc/ld.so.confには/usr/libが入ってない。node以外バイナリはないので問題は無いが、perlやpythonもlib64にdirを作っているのでlib64に入れるのが正しいのだろう)
$ ( cd usr/bin ; ln -sf ../lib64/node_modules/corepack/dist/corepack.js corepack )
$ ( cd usr/bin ; ln -sf ../lib64/node_modules/npm/bin/npm-cli.js npm )
$ ( cd usr/bin ; ln -sf ../lib64/node_modules/npm/bin/npx-cli.js npx )
$ mv -i usr/share/man usr/
$ gzip -9 usr/man/man?/*.?
$ mkdir -p usr/share/bash-completion/completions
$ wget https://slackbuilds.org/slackbuilds/14.2/development/nodejs/npm.sh
$ mv -i npm.sh usr/share/bash-completion/completions/npm
$ find usr -name “.git*” -exec rm -f \{\} \;
$ mkdir -p etc/profile.d
$ cat > etc/profile.d/node.csh << EOF
#!/bin/csh
setenv NODE_PATH /usr/lib64/node_modules
EOF
$ cat > etc/profile.d/node.sh << EOF
#!/bin/sh
export NODE_PATH=/usr/lib64/node_modules
EOF
$ chmod 0755 etc/profile.d/*
$ sudo chown -R root:root .
$ sudo makepkg ../node-v18.18.0-x86_64-1.txz
WARNING: zero length file usr/lib64/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py
WARNING: zero length file usr/lib64/node_modules/npm/node_modules/smart-buffer/docs/ROADMAP.md
WARNING: zero length file usr/lib64/node_modules/npm/.npmrc
$ sudo installpkg ../node-v18.18.0-x86_64-1.txz

$ cd ..
$ find package-nodejs/usr/ -print0 | xargs -0 file | grep -e “executable” -e “shared object” | grep ELF
(node以外のバイナリは無く、不足依存も無かった)
$ export NODE_PATH=/usr/lib64/node_modules
$ node –version
v18.18.0
$ npm –version
9.8.1

$ npm install -g react-devtools
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g npm@10.1.0 to update!
npm notice
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/lib/node_modules’
npm ERR! [Error: EACCES: permission denied, mkdir ‘/usr/lib/node_modules’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘mkdir’,
npm ERR! path: ‘/usr/lib/node_modules’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
\
darkstar:~$ env | grep NODE
NODE_PATH=/usr/lib64/node_modules

NODE_PATHで指定しても、内部コマンド?内部設定?でlibになっている。仕方ないのでlibに戻して再Inst
した。rootで実行してないのもあるが。
$ sudo removepkg node-v18.18.0-x86_64-1.txz
$ cd package-nodejs
lib64 -> lib 変更
$ sudo makepkg ../node-v18.18.0-x86_64-1.txz
$ sudo installpkg ../node-v18.18.0-x86_64-1.txz

$ sudo npm install -g react-devtools
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g npm@10.1.0 to update!
npm notice
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’
(やっぱネットが遅いとこうなるか。が、何回かやるとうまくいくだろ。多分)
$ sudo npm install -g react-devtools
changed 156 packages in 40s
23 packages are looking for funding
\ run `npm fund` for details
(/usr/lib/node_modules以下にInstされた)

参考情報:
bash or zshでnpmの補完設定
https://qiita.com/yuta____/items/64bfd119d4444156b43e
(https://slackbuilds.org/slackbuilds/14.2/development/nodejs/npm.sh を入れるとなる。中身はリンク先と
同じようだ。/usr/share/bash-completion/completions/を見ると他のもある)
\
HTML/CSS/JavaScriptの練習 実践 雑多な記録3 – Slackware-14.2 メモ
https://seesaawiki.jp/lifewithslackarmzaurus_15_0/d/HTML/CSS/JavaScript%a4%ce%ce%fd%bd%ac%20%bc%c2%c1%a9%20%bb%a8%c2%bf%a4%ca%b5%ad%cf%bf%a3%b3
(以前、Angularの入門の入門で少しだけ使った。メモ見て思い出せるか?)
\
そもそもnpmからわからない
https://zenn.dev/antez/articles/a9d9d12178b7b2

 

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です