fraction / oasis

Free, open-source, peer-to-peer social application that helps you follow friends and discover new ones on Secure Scuttlebutt (SSB).
http://oasis-demo.fraction.io
GNU Affero General Public License v3.0
284 stars 42 forks source link

Error: spawn nj-cli ENOENT when building ~/.npm-global/lib/node_modules/@fraction/oasis/node_modules/ssb-validate2-rsjs-node #747

Open bgpugh opened 2 years ago

bgpugh commented 2 years ago

What's the problem you want solved?

When running npm -g install fraction/oasis#semver:on the current stable release of Manjaro-ARM, the build fails with the following:

$ npm -g install fraction/oasis#semver:
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest
npm WARN deprecated emoji-named-characters@1.0.2: This package is no longer maintained
npm ERR! code 1
npm ERR! path ~/.npm-global/lib/node_modules/@fraction/oasis/node_modules/ssb-validate2-rsjs-node
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! node:internal/errors:464
npm ERR!     ErrorCaptureStackTrace(err);
npm ERR!     ^
npm ERR! 
npm ERR! Error: spawn nj-cli ENOENT
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
npm ERR!     at onErrorNT (node:internal/child_process:477:16)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
npm ERR!   errno: -2,
npm ERR!   code: 'ENOENT',
npm ERR!   syscall: 'spawn nj-cli',
npm ERR!   path: 'nj-cli',
npm ERR!   spawnargs: [ 'build', '--release' ]
npm ERR! }

FWIW, this also fails in the same way when building Patchwork, as well as with TOT (npm -g install . when in repository)

bgpugh commented 2 years ago

I just looked into https://www.npmjs.com/package/ssb-validate2-rsjs-node, which mentions that the package requires rust to be installed and functional:

Rust first needs to be installed in order to build the bindings (installation instructions).

git clone git@github.com:ssb-ngi-pointer/ssb-validate2-rsjs-node.git
cd ssb-validate2-rsjs-node
cargo install nj-cli
# generate release build of ssb-validate2-rsjs-node
npm run build
# run the tests
npm run test

The build process creates bindings in ./dist/index.node.

If you wish to rebuild the bindings after making changes to the code, use the nj-cli tool:

nj-cli build --release

bgpugh commented 2 years ago

Confirmed: Making sure I had a working Rust and nj-cli as above resolved the issue. Installation documentation needs to be updated