Cannot install any javascript packages by NPM install

  • We would like to use Node JS as the backend to interact with sqlite3 databases and provide RESTful APIs from Omega2.

    • We have both Node JS and npm installed using opkg package manager according to Omega's document:
      However, when we try to npm install any package - ex. "npm install sqlite3", the command will take a very long time to execute, and will return with errors containing message such as:

    • FATAL ERROR: Malloced operator new Allocation failed - process out of memory
      (We've tried to installed few other npm packages, but all of them end up with the same error)

    • It seems that the reason for such failures is that the npm and NodeJS versions provided by the LEDE package feed is too old (v2.14.12), so it won't work with most of the npm packages (are there any plans to support newer versions of NPM and NodeJS?)

    • It looks like in order to achieve what we need: having the Omega2 interacting with Sqlite3 and providing RESTful APIs, we are only left with PHP implementation, are there any alternatives? and will the PHP work with Sqlite3 as promised?

  • Are you using an external SD card / USB and running the device on external storage (/overlay) ?

    Do you have the 16mb or 32mb version?

    When you type df -h what is your storage space left?

    When installing npm stuff, after the install it leaves temporary files which you can delete the command is here:
    rm -rf ~/.npm

  • When I installed sqlite3 on my Linux PC here are all the dependencies that came with it (The installation folder for the npm module sqlite3 is 15MB):

    mqw sqlite3@3.1.13
    tqq nan@2.7.0
    mqw node-pre-gyp@0.6.38
    tqw hawk@3.1.3
    x tqq boom@2.10.1
    x tqq cryptiles@2.0.5
    x tqq hoek@2.16.3
    x mqq sntp@1.0.9
    tqw mkdirp@0.5.1
    x mqq minimist@0.0.8
    tqw nopt@4.0.1
    x tqq abbrev@1.1.1
    x mqw osenv@0.1.4
    x tqq os-homedir@1.0.2
    x mqq os-tmpdir@1.0.2
    tqw npmlog@4.1.2
    x tqw are-we-there-yet@1.1.4
    x x mqq delegates@1.0.0
    x tqq console-control-strings@1.1.0
    x tqw gauge@2.7.4
    x x tqq aproba@1.2.0
    x x tqq has-unicode@2.0.1
    x x tqq object-assign@4.1.1
    x x tqq signal-exit@3.0.2
    x x tqw string-width@1.0.2
    x x x tqq code-point-at@1.1.0
    x x x mqw is-fullwidth-code-point@1.0.0
    x x x mqq number-is-nan@1.0.1
    x x tqw strip-ansi@3.0.1
    x x x mqq ansi-regex@2.1.1
    x x mqq wide-align@1.1.2
    x mqq set-blocking@2.0.0
    tqw rc@1.2.1
    x tqq deep-extend@0.4.2
    x tqq ini@1.3.4
    x tqq minimist@1.2.0
    x mqq strip-json-comments@2.0.1
    tqw request@2.81.0
    x tqq aws-sign2@0.6.0
    x tqq aws4@1.6.0
    x tqq caseless@0.12.0
    x tqw combined-stream@1.0.5
    x x mqq delayed-stream@1.0.0
    x tqq extend@3.0.1
    x tqq forever-agent@0.6.1
    x tqw form-data@2.1.4
    x x mqq asynckit@0.4.0
    x tqw har-validator@4.2.1
    x x tqw ajv@4.11.8
    x x x tqq co@4.6.0
    x x x mqw json-stable-stringify@1.0.1
    x x x mqq jsonify@0.0.0
    x x mqq har-schema@1.0.5
    x tqw http-signature@1.1.1
    x x tqq assert-plus@0.2.0
    x x tqw jsprim@1.4.1
    x x x tqq assert-plus@1.0.0
    x x x tqq extsprintf@1.3.0
    x x x tqq json-schema@0.2.3
    x x x mqw verror@1.10.0
    x x x mqq assert-plus@1.0.0
    x x mqw sshpk@1.13.1
    x x tqq asn1@0.2.3
    x x tqq assert-plus@1.0.0
    x x tqq bcrypt-pbkdf@1.0.1
    x x tqw dashdash@1.14.1
    x x x mqq assert-plus@1.0.0
    x x tqq ecc-jsbn@0.1.1
    x x tqw getpass@0.1.7
    x x x mqq assert-plus@1.0.0
    x x tqq jsbn@0.1.1
    x x mqq tweetnacl@0.14.5
    x tqq is-typedarray@1.0.0
    x tqq isstream@0.1.2
    x tqq json-stringify-safe@5.0.1
    x tqw mime-types@2.1.17
    x x mqq mime-db@1.30.0
    x tqq oauth-sign@0.8.2
    x tqq performance-now@0.2.0
    x tqq qs@6.4.0
    x tqq safe-buffer@5.1.1
    x tqq stringstream@0.0.5
    x tqw tough-cookie@2.3.3
    x x mqq punycode@1.4.1
    x tqq tunnel-agent@0.6.0
    x mqq uuid@3.1.0
    tqw rimraf@2.6.2
    x mqw glob@7.1.2
    x tqq fs.realpath@1.0.0
    x tqq inflight@1.0.6
    x tqw minimatch@3.0.4
    x x mqw brace-expansion@1.1.8
    x x tqq balanced-match@1.0.0
    x x mqq concat-map@0.0.1
    x mqq path-is-absolute@1.0.1
    tqq semver@5.4.1
    tqw tar@2.2.1
    x tqq block-stream@0.0.9
    x tqw fstream@1.0.11
    x x mqq graceful-fs@4.1.11
    x mqq inherits@2.0.3
    mqw tar-pack@3.4.0
    tqw debug@2.6.9
    x mqq ms@2.0.0
    tqq fstream-ignore@1.0.5
    tqw once@1.4.0
    x mqq wrappy@1.0.2
    tqw readable-stream@2.3.3
    x tqq core-util-is@1.0.2
    x tqq isarray@1.0.0
    x tqq process-nextick-args@1.0.7
    x tqq string_decoder@1.0.3
    x mqq util-deprecate@1.0.2
    mqq uid-number@0.0.6

  • @peterh-peterh like brolly759 mentions you need to do the /overlay with usb drive. i also think you would be wise to do the swap space procedure.

  • FYI even when I do /overlay and make a 2GB swap file, the version of node does crash on some instances like installing "azure-iot-device-amqp" the nodejs run time has its own buffer that needs to be increased, though from the error they posted I dont think its this issue.

    Another thing about npm installs is that in some cases you need python or some other dependency like git and npm builds the module on the onion, that takes a lot of resources. For my application I use 81% file storage and have 4.7mb left but I have these modules installed:


    If you want to do RESTful messages using Oauth2, I have successfully done so using "client-oauth2" and "popcicile"

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