Is there a way to use OracleDB with Node 10.15? - node.js

I am limited in my cloud environment to Node v10.15.x and I need 10+ for experimental-modules. However, when I try to install OracleDB I get...
oracledb ERR! NJS-069: node-oracledb 4.1.0 requires Node.js 10.16 or later
oracledb ERR! An older node-oracledb version may work with Node.js v10.15.0
If I try downgrading OracleDB to 3.1.2 it requires Node 8 so this won't work either.
oracledb ERR! NJS-067: a pre-built node-oracledb binary was not found for Node.js v12.1.0 (NODE_MODULE_VERSION=72) on win32 x64
oracledb ERR! Try compiling node-oracledb source code using https://oracle.github.io/node-oracledb/INSTALL.html#github
Is there a way to get oracledb to work with Node 10.15?
Update
This seems to not be clear so let me be explicit. Locally I have Node 12 this works fine with v 4.1.0 of OracleDB. However, this doen't work when I try to upload to Cloud Foundry because the version is 10.15. When I downgrade to 3.1.2 OracleDB it no longer compiles locally and won't deploy to Gaia because it needs a version of node that is less than 9 and we need greater than 9 for other features.

There were prebuilt node-oracledb 3.1.2 binaries for Node 6, 8, 10, and 11.
Your text above says you want to use Node.js 10.15 but your example shows you tried to install on Node.js 12: Node.js v12.1.0 (NODE_MODULE_VERSION=72), hence your error. Make sure Node.js is the desired version 10, and try again with node-oracledb 3.1.2.
If you want to use node-oracledb 4 with Node.js 10.15, then compile from source code. The message is clear.
But you really should upgrade Node.js to a later version and get all the Node.js security fixes.
Update to address comment: if npm can't access the npmjs.com repo, you may be able to manually download https://registry.npmjs.com/oracledb/-/oracledb-3.1.2.tgz and install from a local file e.g. npm install /file/path/to/oracledb-3.1.2.tgz or in package.json use a dependency "oracledb": "file:/file/path/to/oracledb-3.1.2.tgz", similar to https://oracle.github.io/node-oracledb/INSTALL.html#selfhost.

Related

NPM active-win package with NODE_MODULE_VERSION 106

I'm working on a little Electron.js app. I want to get information about active window so I came across npm package active-win. I get it working at Linux and OSx without problem, but on Windows I get version error.
UnhandledPromiseRejectionWarning: Error: The module '\\?\C:\...\git\in_sane_factory\desktop-app\node_modules\iconv\build\Release\iconv.node'was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 106. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
The iconv package is needed for active-win in version above 2. Highest version and default to install is 2.3.5. Only other version that I manage to install was 2.3.4 and that did not solve anything.
I tried to npm install, npm rebuild, cloning iconv repository and installing this version manualy via npm install <path>.
I tried to install the right version of Node.js but by official version table, there is no version 106. I only manage to upgrade from 93 to 108.
I'm not really skilled Node.js user and now I'm trully hopeless. Do you have any advice or idea, what may solve this?
Sources:
My APP: https://gitlab.com/insanefactory/desktop-app
iconv NPM: https://www.npmjs.com/package/iconv
active-win NPM: https://www.npmjs.com/package/active-win
ref-wchar-napiNPM: https://www.npmjs.com/package/ref-wchar-napi
NPM releas version table: https://nodejs.org/en/download/releases/
Node.js version or version of package was not the issue in the end. After a few weeks I found out, where I was wrong. All needed to fix it was installing electron-rebuild and then running simple .\node_modules\.bin\electron-rebuild.cmd.
Hope, if you come across similar problem, this can help you as well.
I think you are basically running a different nodejs version on your windows machine. Cross check with the version on your Mac to confirm.

How to match NodeJS version with compatible package

I have to run NodeJS app in very old nodejs (version 8.17) and I can't do an update (it is embed in industrial computer with dependencies on this version of node). When I do my regular yarn add express sqlite3 ... and run my app, error apperas
node-pre-gyp info This Node instance does not support builds for Node-API version 6
My question is, can I somehow force yarn/npm to install compatible package version or at least, match node version with compatible package version and install them manually after that?
Thank you for your answers.

NG command is displaying incorrect node version

I am getting below error when I tried to use ng command
Node.js version v11.13.0 detected.
The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.
Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
When I try to see the node version using node -v, I see node version on my machine is v12.18.3
So from where ng is getting v11.13.0? How do I resolve this issue?
I tried below steps
Clear the NPM cache
Uninstall both node versions from the NVM
Uninstall anything that starts with node in Control Panel\Programs and Features
Install required node versions in NVM
Install Angular CLI
and things started working for me.
Had the same issue. It turns out installed Angular CLI was not compatible with the installed node and npm version. I used the https://stackoverflow.com/a/60258560 to check the compatibility. Then performed following steps:
Uninstall Angular cli
Uninstall Node and NVM
Installed Node version I wanted (10.x).
Installed specific Angular version corresponding to Node v10 which was Angular Cli v11 at this time.
I was also facing the same issue in my Windows machine where the node -v version and the version picked up by ng command were different. This was because my node.js command prompt was picking the version from AppData\Roaming\npm folder. Cleaning up this folder fixed the issue for me.
Uninstall node
Empty the contents from C:\Users<user>\AppData\Roaming\npm
Install the required node version

Unable to load oracledb

I'm upgrading my Node js application from version 8 to version 10
suddenly when i tried to run the application it throws an error with the description bellow
cannot load the oracledb add-on binary for Node.js 10.9.0 (win32, x64)
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing the
module (for instance, using npm rebuild or npm install).
Node-oracledb installation instructions:
https://oracle.github.io/node-oracledb/INSTALL.html
if i downgrade my nodejs to version 8, it works like a charm, my application uses some version 10 features that recently added
i have tried to remove all modules and then i typed npm install in order to reinstall modules properly i got failed with message above.
i also tried to follow node js installation with no luck, what should i do ?

Can't create new Angular project

Installed the Angular CLI using this command
npm install -g #angular/cli
But when creating new project using command
ng new PROJECT-NAME
it shows
You are running version v8.0.0 of Node.js, which is not supported by
Angular CLI v6. The official Node.js version that is supported is
8.9 and greater. Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.
But actually i am using nodejs v9.11.1
See screenshot of my cli
Mostly sounds like a version problem. The new angular cli version requires the latest version of node.
All you need to do is update node and npm to latest version , everything should work fine.
If you are working on windows I'd suggest just going on their site and getting the latest one(currently at the time of this post is 8.11.2). For linux based and mac I would suggest looking for a guide how to get latest version since installing from terminal with something like (apt-get install or yum) will not have latest version you need (can easily be changed with some simple commands)
Also do check the version of node with: node -v
There has also been a naming conflict on linux regarding node vs nodejs see this question.

Resources