Peertube: Cannot install bcrypt on node 8.12

Created on 11 Sep 2018  Â·  9Comments  Â·  Source: Chocobozzz/PeerTube

error An unexpected error occurred: "EACCES: permission denied, mkdir '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/brorand'".


and ...

  inflating: peertube-v1.0.0-beta.12/yarn.lock  
yarn install v1.9.4
[1/5] Validating package.json...
[2/5] Resolving packages...
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[1/6] ⢀ bcrypt
[-/6] ⢀ waiting...
[6/6] ⢀ youtube-dl
[4/6] ⢀ rdf-canonize
error /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp info check checked for "/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
node-pre-gyp http 302 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error Remote end closed socket abruptly. 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/npm/node_modules/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   '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/var/www/peertube/.node-gyp/8.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/var/www/peertube/.node-gyp/8.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/var/www/peertube/.node-gyp/8.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt',
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=.' ]
node-pre-gyp http 200 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
gyp info ok 
node-pre-gyp info install unpacking binding/bcrypt_lib.node
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error bad download 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp../src/blowfish.cc:642:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory
 }
 ^
compilation terminated.

Same results for upgrade script like root and peertube user.

With Node 8.11.4 works upgrade script fine.

Debian 9.6, Nodejs 8.12.

Type

All 9 comments

What version of gcc do you have? Also, it seems you are running npm on an installation folder of PeerTube whose rights limit your access to read-only (EACCESS). That is a common error cause for bcrypt installations.

gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

root@nodejs:/var/www/peertube# ls -la
total 72
drwxr-xr-x 11 peertube peertube 4096 Sep 11 21:59 .
drwxr-xr-x 4 root root 4096 Aug 25 13:44 ..
drwxr-xr-x 2 peertube peertube 4096 Sep 11 21:53 backup
-rw------- 1 peertube peertube 752 Sep 11 21:59 .bash_history
-rw-r--r-- 1 peertube peertube 220 May 15 2017 .bash_logout
-rw-r--r-- 1 peertube peertube 3526 May 15 2017 .bashrc
drwxr-xr-x 4 peertube peertube 4096 Aug 25 14:13 .cache
drwxr-xr-x 2 peertube peertube 4096 Sep 11 20:25 config
drwx------ 3 peertube peertube 4096 Aug 25 13:41 .config
drwxr-xr-x 4 peertube peertube 4096 Sep 11 20:37 .node-gyp
drwxr-xr-x 5 peertube peertube 4096 Sep 11 20:37 .npm
lrwxrwxrwx 1 peertube peertube 51 Sep 11 21:53 peertube-latest -> /var/www/peertube//versions/peertube-v1.0.0-beta.12
-rw-r--r-- 1 peertube peertube 675 May 15 2017 .profile
-rw------- 1 peertube peertube 1024 Aug 28 04:37 .rnd
drwxr-xr-x 10 peertube peertube 4096 Aug 25 13:47 storage
drwxr-xr-x 4 peertube peertube 4096 Sep 11 22:00 versions
-rw-r--r-- 1 peertube peertube 165 Aug 25 13:39 .wget-hsts
drwxr-xr-x 3 peertube peertube 4096 Aug 25 13:40 .yarn
-rw-r--r-- 1 peertube peertube 116 Sep 11 20:37 .yarnrc

It's actually directory /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/brorand which would need a permission check.

Ok, i did:
chown -R peertube:peertube /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules
and again:

sudo -H -u peertube yarn install --production --pure-lockfile

yarn install v1.9.4
[1/5] Validating package.json...
[2/5] Resolving packages...
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/[email protected]"
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[1/6] â ‚ bcrypt
[6/6] â ‚ youtube-dl
[-/6] â ‚ waiting...
[4/6] â ‚ rdf-canonize
error /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp info check checked for "/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
node-pre-gyp http 302 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error Remote end closed socket abruptly. 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/npm/node_modules/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   '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/var/www/peertube/.node-gyp/8.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/var/www/peertube/.node-gyp/8.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/var/www/peertube/.node-gyp/8.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt',
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=.' ]
node-pre-gyp http 200 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-linux-x64-glibc.tar.gz
gyp info ok 
node-pre-gyp info install unpacking binding/bcrypt_lib.node
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error bad download 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/npm/node_modules/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   '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/var/www/peertube/.node-gyp/8.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/var/www/peertube/.node-gyp/8.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/var/www/peertube/.node-gyp/8.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt',
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 ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
../src/blowfish.cc:642:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory
 }
 ^
compilation terminated.
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: Leaving directory '/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/build'
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.18-4-pve
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.15.18-4-pve
node-pre-gyp ERR! command "/usr/bin/node" "/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
  COPY /var/www/peertube/versions/peertube-v1.0.0-beta.12/node_modules/bcrypt/lib/binding/bcrypt_lib.node

Related to https://github.com/kelektiv/node.bcrypt.js/issues/648

Try to downgrade to node 8.11.4

Peertube with Yunohost is failing on node 8.12 too. And my default it will upgrade node to version 8.12 from previous versions. Now every upgrade would fail for Yunohost till this get fixed.

https://github.com/YunoHost-Apps/peertube_ynh/issues/39#issuecomment-420825550

@Chocobozzz

A minor release with this fix?

Yep, this afternoon

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MikaXII picture MikaXII  Â·  3Comments

XenonFiber picture XenonFiber  Â·  3Comments

filmaidykai picture filmaidykai  Â·  3Comments

roipoussiere picture roipoussiere  Â·  3Comments

XenonFiber picture XenonFiber  Â·  3Comments