animetosho / ParPar

High performance PAR2 create client for NodeJS
195 stars 21 forks source link

Ubuntu 20.04: "Error: Cannot find module '../build/Release/parpar_gf.node'" #23

Closed sanderjo closed 4 years ago

sanderjo commented 4 years ago

Possibly a PEBKAC, but I get this on Ubuntu 20.04:


$ sudo npm install -g @animetosho/parpar
/usr/local/bin/parpar -> /usr/local/lib/node_modules/@animetosho/parpar/bin/parpar.js

> @animetosho/parpar@0.3.2 install /usr/local/lib/node_modules/@animetosho/parpar
> node-gyp rebuild

I'm assuming that output is OK. So:

$ parpar
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../build/Release/parpar_gf.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@animetosho/parpar/lib/par2.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Based on https://github.com/animetosho/ParPar/issues/19#issuecomment-543688405 I tried

$ sudo npm install nexe@1.1.3
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN saveError ENOENT: no such file or directory, open '/home/sander/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/sander/package.json'
npm WARN sander No description
npm WARN sander No repository field.
npm WARN sander No README data
npm WARN sander No license field.

+ nexe@1.1.3
added 266 packages from 278 contributors and audited 1518 packages in 13.06s

2 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

I have no idea what is going on. Tips?

More: I tried on my Ubuntu 18.04, and that gives a different output:

$ sudo npm install -g @animetosho/parpar
[sudo] password for sander: 
/usr/local/bin/parpar -> /usr/local/lib/node_modules/@animetosho/parpar/bin/parpar.js

> @animetosho/parpar@0.3.2 install /usr/local/lib/node_modules/@animetosho/parpar
> node-gyp rebuild

make: Entering directory '/usr/local/lib/node_modules/@animetosho/parpar/build'
  CC(target) Release/obj.target/gf-complete/gf-complete/gf.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle128_neon.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle256.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle512.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor256.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor512.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/affine128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/affine512.o
  AR(target) Release/obj.target/gf-complete.a
  COPY Release/gf-complete.a
  CC(target) Release/obj.target/multi_md5/md5/md5.o
  CC(target) Release/obj.target/multi_md5/md5/md5-simd.o
  AR(target) Release/obj.target/multi_md5.a
  COPY Release/multi_md5.a
  CXX(target) Release/obj.target/parpar_gf/src/gf.o
  CXX(target) Release/obj.target/parpar_gf/gf-complete/module.o
  CXX(target) Release/obj.target/parpar_gf/src/gyp_warnings.o
  SOLINK_MODULE(target) Release/obj.target/parpar_gf.node
  COPY Release/parpar_gf.node
make: Leaving directory '/usr/local/lib/node_modules/@animetosho/parpar/build'
/usr/local/lib
└── @animetosho/parpar@0.3.2 

and then OK:

$ parpar
Values for `out` and `input-slices` are required
Enter `parpar --help` for usage information
sanderjo commented 4 years ago

Ah, it seems something Ubuntu 20.04 specific:

I started a fresh, clean Ubuntu 20.04 docker, and same behaviour, so it's reproducable:

sudo docker run -it ubuntu:20.04 /bin/bash and in there:

apt update
apt upgrade
apt install npm
npm install -g @animetosho/parpar
parpar

with same result:

root@0160608453cb:/# npm install -g @animetosho/parpar
/usr/local/bin/parpar -> /usr/local/lib/node_modules/@animetosho/parpar/bin/parpar.js

> yencode@1.1.0 install /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode
> node-gyp rebuild

root@0160608453cb:/# parpar
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../build/Release/parpar_gf.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@animetosho/parpar/lib/par2.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
sanderjo commented 4 years ago

I tried the "Install From Source", but at the end results in about the same:

  CXX(target) Release/obj.target/yencode/src/platform.o
  CXX(target) Release/obj.target/yencode/src/encoder.o
  CXX(target) Release/obj.target/yencode/src/decoder.o
  CXX(target) Release/obj.target/yencode/src/crc.o
  SOLINK_MODULE(target) Release/obj.target/yencode.node
  COPY Release/yencode.node
make: Leaving directory '/ParPar/node_modules/yencode/build'
npm WARN lifecycle @animetosho/parpar@0.3.2~install: cannot run in wd @animetosho/parpar@0.3.2 node-gyp rebuild (wd=/ParPar)
npm notice created a lockfile as package-lock.json. You should commit this file.
added 3 packages from 4 contributors and audited 3 packages in 25.121s
found 0 vulnerabilities

root@23ced91cd4ff:/ParPar# parpar
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../build/Release/parpar_gf.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@animetosho/parpar/lib/par2.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Full:

root@23ced91cd4ff:/ParPar# node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@10.19.0 | linux | x64
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/share/nodejs/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   '/ParPar/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/share/nodejs/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/include/nodejs/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/usr/include/nodejs',
gyp info spawn args   '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/ParPar',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/ParPar/build'
  CC(target) Release/obj.target/gf-complete/gf-complete/gf.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle128_neon.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle256.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/shuffle512.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor256.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/xor512.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/affine128.o
  CC(target) Release/obj.target/gf-complete/gf-complete/gf_w16/affine512.o
  AR(target) Release/obj.target/gf-complete.a
  COPY Release/gf-complete.a
  CC(target) Release/obj.target/multi_md5/md5/md5.o
  CC(target) Release/obj.target/multi_md5/md5/md5-simd.o
  AR(target) Release/obj.target/multi_md5.a
  COPY Release/multi_md5.a
  CXX(target) Release/obj.target/parpar_gf/src/gf.o
  CXX(target) Release/obj.target/parpar_gf/gf-complete/module.o
  CXX(target) Release/obj.target/parpar_gf/src/gyp_warnings.o
  SOLINK_MODULE(target) Release/obj.target/parpar_gf.node
  COPY Release/parpar_gf.node
make: Leaving directory '/ParPar/build'
gyp info ok 
root@23ced91cd4ff:/ParPar# npm install

> yencode@1.1.0 install /ParPar/node_modules/yencode
> node-gyp rebuild

make: Entering directory '/ParPar/node_modules/yencode/build'
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/crc32c_sse4.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o
  CXX(target) Release/obj.target/crcutil/crcutil-1.0/examples/interface.o
  AR(target) Release/obj.target/crcutil.a
  COPY Release/crcutil.a
  CXX(target) Release/obj.target/yencode_sse2/src/encoder_sse2.o
  CXX(target) Release/obj.target/yencode_sse2/src/decoder_sse2.o
  AR(target) Release/obj.target/yencode_sse2.a
  COPY Release/yencode_sse2.a
  CXX(target) Release/obj.target/yencode_ssse3/src/encoder_ssse3.o
  CXX(target) Release/obj.target/yencode_ssse3/src/decoder_ssse3.o
  AR(target) Release/obj.target/yencode_ssse3.a
  COPY Release/yencode_ssse3.a
  CC(target) Release/obj.target/yencode_clmul/src/crc_folding.o
  AR(target) Release/obj.target/yencode_clmul.a
  COPY Release/yencode_clmul.a
  CXX(target) Release/obj.target/yencode_avx/src/encoder_avx.o
  CXX(target) Release/obj.target/yencode_avx/src/decoder_avx.o
  AR(target) Release/obj.target/yencode_avx.a
  COPY Release/yencode_avx.a
  CXX(target) Release/obj.target/yencode_avx2/src/decoder_avx2.o
  CXX(target) Release/obj.target/yencode_avx2/src/encoder_avx2.o
  AR(target) Release/obj.target/yencode_avx2.a
  COPY Release/yencode_avx2.a
  CXX(target) Release/obj.target/yencode_neon/src/encoder_neon.o
  CXX(target) Release/obj.target/yencode_neon/src/decoder_neon.o
  AR(target) Release/obj.target/yencode_neon.a
  COPY Release/yencode_neon.a
  CXX(target) Release/obj.target/yencode_armcrc/src/crc_arm.o
  AR(target) Release/obj.target/yencode_armcrc.a
  COPY Release/yencode_armcrc.a
  CXX(target) Release/obj.target/yencode/src/yencode.o
In file included from ../src/yencode.cc:2:
/usr/include/nodejs/src/node.h:593:51: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>)' to 'node::addon_context_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)'} [-Wcast-function-type]
  593 |       (node::addon_context_register_func) (regfunc),                  \
      |                                                   ^
/usr/include/nodejs/src/node.h:611:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE_X'
  611 |   NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/nodejs/src/node.h:634:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE'
  634 |   NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME,                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/yencode.cc:428:1: note: in expansion of macro 'NODE_MODULE_INIT'
  428 | NODE_MODULE_INIT(/* exports, module, context */)
      | ^~~~~~~~~~~~~~~~
  CXX(target) Release/obj.target/yencode/src/platform.o
  CXX(target) Release/obj.target/yencode/src/encoder.o
  CXX(target) Release/obj.target/yencode/src/decoder.o
  CXX(target) Release/obj.target/yencode/src/crc.o
  SOLINK_MODULE(target) Release/obj.target/yencode.node
  COPY Release/yencode.node
make: Leaving directory '/ParPar/node_modules/yencode/build'
npm WARN lifecycle @animetosho/parpar@0.3.2~install: cannot run in wd @animetosho/parpar@0.3.2 node-gyp rebuild (wd=/ParPar)
npm notice created a lockfile as package-lock.json. You should commit this file.
added 3 packages from 4 contributors and audited 3 packages in 25.121s
found 0 vulnerabilities

root@23ced91cd4ff:/ParPar# parpar
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../build/Release/parpar_gf.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@animetosho/parpar/lib/par2.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
root@23ced91cd4ff:/ParPar# 
sanderjo commented 4 years ago

Focussing on Error: Cannot find module '../build/Release/parpar_gf.node':

On Ubuntu 18.04:

sander@brixit:/usr/local/lib/node_modules/@animetosho/parpar$ find . -name parpar_gf.node
./build/Release/obj.target/parpar_gf.node
./build/Release/parpar_gf.node

On Ubuntu 20.04 (docker):

root@23ced91cd4ff:/usr/local/lib/node_modules/@animetosho/parpar# find . -name parpar_gf.node
root@23ced91cd4ff:/usr/local/lib/node_modules/@animetosho/parpar# 

Nothing. Different search on the same Ubuntu 20.04:

root@23ced91cd4ff:/usr/local/lib/node_modules/@animetosho/parpar# find / -name parpar_gf.node
/ParPar/build/Release/obj.target/parpar_gf.node
/ParPar/build/Release/parpar_gf.node

So parpar_gf.node is in `/ParPar', because that is the github directory?

What happens if I specify the full path:

root@23ced91cd4ff:~# /ParPar/bin/parpar.js 
Values for `out` and `input-slices` are required
Enter `parpar --help` for usage information

root@23ced91cd4ff:~# /ParPar/bin/parpar.js -s2000 --min-input-slices=1 -r10% -d pow2 -o my-test  blabla.bin
Multiply method used: Shuffle (256 bit), 4 threads
Generating 10 MiB recovery data (200 slices) from 100 MiB of data
Calculating: 100.00%
PAR2 created. Time taken: 1.502 second(s)
root@23ced91cd4ff:~#

OK, that works.

But I'm lost

sanderjo commented 4 years ago

Back on the bare metal Ubuntu 20.04:

sander@witte2004:~$ df -h /usr/local/lib/node_modules/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       117G  101G   11G  91% /

sander@witte2004:~$ sudo npm install  -g @animetosho/parpar --loglevel verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '-g',
npm verb cli   '@animetosho/parpar',
npm verb cli   '--loglevel',
npm verb cli   'verbose' ]
npm info using npm@6.14.5
npm info using node@v10.19.0
npm verb npm-session 3ae9b8aebe2b5b79
npm http fetch GET 304 https://registry.npmjs.org/@animetosho%2fparpar 196ms (from cache)
npm timing stage:loadCurrentTree Completed in 239ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
npm http fetch GET 304 https://registry.npmjs.org/yencode 45ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/async 96ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/lodash 48ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 171ms
npm timing stage:loadIdealTree Completed in 178ms
npm timing stage:generateActionsToTake Completed in 10ms
npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
npm timing action:extract Completed in 427ms
npm timing action:finalize Completed in 13ms
npm timing action:refresh-package-json Completed in 42ms
npm info lifecycle lodash@4.17.15~preinstall: lodash@4.17.15
npm info lifecycle async@2.6.3~preinstall: async@2.6.3
npm info lifecycle yencode@1.1.0~preinstall: yencode@1.1.0
npm info lifecycle @animetosho/parpar@0.3.2~preinstall: @animetosho/parpar@0.3.2
npm timing action:preinstall Completed in 5ms
npm info linkStuff lodash@4.17.15
npm info linkStuff async@2.6.3
npm info linkStuff yencode@1.1.0
npm info linkStuff @animetosho/parpar@0.3.2
npm verb linkBins [ { parpar: 'bin/parpar.js' }, '/usr/local/bin', true ]
/usr/local/bin/parpar -> /usr/local/lib/node_modules/@animetosho/parpar/bin/parpar.js
npm timing action:build Completed in 7ms
npm info lifecycle lodash@4.17.15~install: lodash@4.17.15
npm info lifecycle async@2.6.3~install: async@2.6.3
npm info lifecycle yencode@1.1.0~install: yencode@1.1.0

> yencode@1.1.0 install /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using node-gyp@5.1.0
gyp info using node@10.19.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - "python" is not in PATH or produced an error
gyp verb find Python checking if "python2" can be used
gyp verb find Python - executing "python2" to get executable path
gyp verb find Python - executable path is "/usr/bin/python2"
gyp verb find Python - executing "/usr/bin/python2" to get version
gyp verb find Python - version is "2.7.18"
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2"
gyp verb get node dir no --target version specified, falling back to host node version: 10.19.0
gyp verb command install [ '10.19.0' ]
gyp verb install input version string "10.19.0"
gyp verb install installing version: 10.19.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/10.19.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '--node_gyp_internal_noretry', '10.19.0' ]
gyp verb install input version string "10.19.0"
gyp verb install installing version: 10.19.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 10.19.0
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/.node-gyp/10.19.0
gyp WARN install got an error, rolling back install
gyp verb command remove [ '10.19.0' ]
gyp verb remove using node-gyp dir: /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/.node-gyp
gyp verb remove removing target version: 10.19.0
gyp verb remove removing development files for version: 10.19.0
gyp WARN install got an error, rolling back install
gyp verb command remove [ '10.19.0' ]
gyp verb remove using node-gyp dir: /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/.node-gyp
gyp verb remove removing target version: 10.19.0
gyp verb remove removing development files for version: 10.19.0
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/.node-gyp'
gyp ERR! System Linux 5.4.0-29-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm verb lifecycle yencode@1.1.0~install: unsafe-perm in lifecycle false
npm verb lifecycle yencode@1.1.0~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode/node_modules/.bin:/usr/local/lib/node_modules/@animetosho/parpar/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
npm verb lifecycle yencode@1.1.0~install: CWD: /usr/local/lib/node_modules/@animetosho/parpar/node_modules/yencode
npm info lifecycle yencode@1.1.0~install: Failed to exec install script
npm timing action:install Completed in 1655ms
npm verb unlock done using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 161ms
npm timing stage:runTopLevelLifecycles Completed in 2756ms
npm verb stack Error: yencode@1.1.0 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:198:13)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:198:13)
npm verb stack     at maybeClose (internal/child_process.js:982:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm verb pkgid yencode@1.1.0
npm verb cwd /home/sander
npm verb Linux 5.4.0-29-generic
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "install" "-g" "@animetosho/parpar" "--loglevel" "verbose"
npm verb node v10.19.0
npm verb npm  v6.14.5
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yencode@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the yencode@1.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 3195ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-05-08T13_02_22_525Z-debug.log
sander@witte2004:~$ 
sanderjo commented 4 years ago

FWIW On Ubuntu 20.04 there is no python, only python2 and python3 after installing them. So I tried ln -s /usr/bin/python2 /usr/bin/python and then the install procedure, but ... same result.

animetosho commented 4 years ago

Thanks for finding that and posting all the detailed info!

I've given this a try with a fresh install of Ubuntu 20.04, and it seems that it just won't compile if installed globally (the -g flag to NPM), which means that the parpar_gf.node file (compiled code) is missing.

Note that the "install from source" doesn't install ParPar globally (I should clarify this in the readme, thanks for raising that), so when you issue the parpar command, it's just referring to the NPM installed version. When you specify the path manually (/ParPar/bin/parpar.js in your case), it's pointing to the version built from source, and seems to be working.
If you want to use this version, you can just symlink to this file from a file in your PATH (e.g. ln -s /ParPar/bin/parpar.js /usr/bin/parpar)

I did some investigation as to why the NPM install isn't working:

The NPM install seems to work for me after that. Note that it seems to work fine with the default Python setup in Ubuntu 20.04.

Let me know if that works for you!

sanderjo commented 4 years ago

It works after following your advice 1 & 2:

wget https://raw.githubusercontent.com/npm/uid-number/v0.0.6/get-uid-gid.js
sudo cp get-uid-gid.js /usr/lib/nodejs/uid-number/
sudo npm uninstall -g @animetosho/parpar
sudo npm install -g --unsafe-perm   @animetosho/parpar

... and I have a working parpar. Thank you!

Out of curiosity: where is the bug? In Ubuntu 20.04, or npm, or parpar, or ... ?

FWIW

Before dowing the above I did a non-global so no-sudo npm install @animetosho/parpar, which gave a working (AFAIK)

~/node_modules/@animetosho/parpar/bin/parpar.js

But of course your solution is better. Thank you.

animetosho commented 4 years ago

Thanks for reporting your results!

Out of curiosity: where is the bug? In Ubuntu 20.04, or npm, or parpar, or ... ?

The first one looks like a bug in the Ubuntu package. I've reported it here: https://bugs.launchpad.net/ubuntu/+source/node-uid-number/+bug/1877704
(on more careful inspection, it looks like the Debian package also has the same issue so maybe it's actually from there)

The second one is probably a change in NPM. It effectively breaks native addons which are installed globally, but presumably it's here to stay. Searches I've done seem to suggest just working around the issue. The official documentation feels a little too onerous to expect from end users, in my opinion, so I'm going to suggest just bypassing the issue with --unsafe-perm.
It might be something that the distro packagers could improve though (e.g. create a specific user and run install scripts with that user's permissions).

animetosho commented 3 years ago

Got an update on Ubuntu bug - now marked as fix released. It appears that the Debian package is also fixed.