Upgrading Node and Node-npm



  • I am trying to install a npm package on my Onion Omega2+ to use WebSocket Tunneling. To install it I used a simple npm install code: node --max_old_space_size=64 $(which npm) install wstunnel. First, I got an npm warning that node-uuid is version 3.4.0 and needs to be upgraded to at least 7 but I upgraded it right before. Next I get the following set of errors that I have put at the bottom. I am unsure as to where to go from here. This npm command runs smoothly on my WSL Ubuntu, azur VM and even my raspberry pi3 but when I tried updating npm and node to newer versions but was unsuccessful. Any help would be much appreciated, thanks.

    gyp ERR! UNCAUGHT EXCEPTION
    gyp ERR! stack TypeError: Object.fromEntries is not a function
    gyp ERR! stack at Object.<anonymous> (/root/node_modules/@npmcli/fs/lib/fs.js:6:23)
    gyp ERR! stack at Module._compile (module.js:652:30)
    gyp ERR! stack at Object.Module._extensions..js (module.js:663:10)
    gyp ERR! stack at Module.load (module.js:565:32)
    gyp ERR! stack at tryModuleLoad (module.js:505:12)
    gyp ERR! stack at Function.Module._load (module.js:497:3)
    gyp ERR! stack at Module.require (module.js:596:17)
    gyp ERR! stack at require (internal/module.js:11:18)
    gyp ERR! stack at Object.<anonymous> (/root/node_modules/@npmcli/fs/lib/index.js:2:6)
    gyp ERR! stack at Module._compile (module.js:652:30)
    gyp ERR! System Linux 4.14.81
    gyp ERR! command "/usr/bin/node" "/root/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /root/node_modules/bufferutil
    gyp ERR! node -v v8.10.0
    gyp ERR! node-gyp -v v9.3.1
    gyp ERR! Node-gyp failed to build your package.
    gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
    npm WARN root@1.0.0 No description
    npm WARN root@1.0.0 No repository field.

    npm ERR! code ELIFECYCLE
    npm ERR! errno 7
    npm ERR! bufferutil@4.0.7 install: node-gyp-build
    npm ERR! Exit status 7
    npm ERR!
    npm ERR! Failed at the bufferutil@4.0.7 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /root/.npm/_logs/2023-05-31T19_28_02_902Z-debug.log


    Log in to reply
     


  • @santi29051 Looks to me that npm is trying to download some dependencies and is failing. The message "No repository field." I expect is because the script is determining what to download based upon the detected OS. Have you checked wstunnel is compatible with OpenWrt<version>? I had expected there would be a memory issue, but your logging does not report that. Perhaps refer to the documentation regarding nodejs https://docs.onion.io/omega2-docs/installing-and-using-nodejs.html



  • @crispyoz I have not found ant specifics talking about WS tunnel for OpenWrt. I found the code to be used from github here: https://github.com/mhzed/wstunnel. I have been looking at the documentation for nodejs but haven't found anything too useful. I am still very new to both the Onion and programing and developing as a whole so I'm not even sure what to look for.


  • administrators

    @santi29051 iirc node-gyp-build tries to compile node packages directly on your device. As opposed to just downloading javascript files.

    Check out this docs article: http://docs.onion.io/omega2-docs/node-red-article.html#installing-node-packages-that-require-compilation

    Note that you'll need more storage space - so an omega2 pro or extending the omega's storage (also available on the docs)



  • @Lazar-Demin Even after following the instructions for node packages that need compiling, I still get the same error message when trying to run node --max_old_space_size=512 $(which npm) install wstunnel. Any other possible solutions or suggestions?


  • administrators

    @santi29051 this line in the error message caught my attention: gyp ERR! stack TypeError: Object.fromEntries is not a function
    I suggest checking if the wstunnel package depends on a specific minimum node version.



  • @Lazar-Demin If i am not mistaken from the package-lock.json file it has a minimum node requirement of 10.12. Is there a way to update the node on the Onion to that? I tried installing NVM but even after getting it in the onion the command was never recognized


Log in to reply
 

1 out of 7

Looks like your connection to Community was lost, please wait while we try to reconnect.