idangozlan / verdaccio-bitbucket

BitBucket auth plugin for verdaccio
MIT License
7 stars 17 forks source link

error loading a plugin bitbucket - cannot find module bcrypt #32

Open sators opened 4 years ago

sators commented 4 years ago

Upon a fresh install under Ubuntu 20 using npm install -g verdaccio-bitbucket and the default auth config, once launching verdaccio it fails with the following error:

 error--- error loading a plugin bitbucket: { Error: Cannot find module '/usr/local/lib/node_modules/verdaccio-bitbucket/node_modules/bcrypt/lib/binding/bcrypt_lib.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/verdaccio-bitbucket/node_modules/bcrypt/bcrypt.js:6:16)
    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) code: 'MODULE_NOT_FOUND' }
 error--- verdaccio-bitbucket doesn't look like a valid plugin
(node:13010) UnhandledPromiseRejectionWarning: Error: sanity check has failed, "bitbucket" is not a valid plugin
    at Object.keys.map.pluginId (/usr/local/lib/node_modules/verdaccio/build/lib/plugin-loader.js:143:13)
    at Array.map (<anonymous>)
    at loadPlugin (/usr/local/lib/node_modules/verdaccio/build/lib/plugin-loader.js:62:37)
    at Auth._loadPlugin (/usr/local/lib/node_modules/verdaccio/build/lib/auth.js:54:38)
    at new Auth (/usr/local/lib/node_modules/verdaccio/build/lib/auth.js:44:25)
    at defineAPI (/usr/local/lib/node_modules/verdaccio/build/api/index.js:43:16)
    at _default (/usr/local/lib/node_modules/verdaccio/build/api/index.js:127:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)

This is resolved by:

$ sudo su -
$ cd /usr/local/lib/node_modules/verdaccio-bitbucket/node_modules
$ npm rebuild bcrypt

Then verdaccio successfully launches:

$ verdaccio
 warn --- config file  - /home/ubuntu/verdaccio/config.yaml
 warn --- Verdaccio started
 warn --- Plugin successfully loaded: verdaccio-bitbucket
 warn --- Plugin successfully loaded: verdaccio-audit
sators commented 4 years ago

Possibly related to https://github.com/kelektiv/node.bcrypt.js/issues/566

sators commented 2 years ago

Issue still exists in v3.0.1