-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Angular: oracledb.js 48:21-45 Critical dependency #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I interpret the messages correctly, they are pointing to the require() calls that try to load the node-oracledb binary. @snehaljoshi72 since you have the environment set up, can you debug and see what the problem is? Based on a quick google, maybe even changing the code flow which is effectively:
to
might work. |
Still not working.
|
@snehaljoshi72 keep debugging! Where is oracledb.node? etc etc? |
after I changed to Path in require following error I am getting. |
Maybe if you post details about how you have built / deployed, then someone with experience will comment? |
I created bootstrap-vue project using web-pack.In my use case I need to get data from oracle db and show it to table. I am using Oracle Instant client v12. import oracledb from 'oracledb'. I checked oracledb.js in /oracledb/lib/oracledb.js which require oracledb.node file which is in /build/Release/oracledb.node location but not able to find it. |
@snehaljoshi72 The <script> tags indicate client-side/browser JavaScript code. This module is for Node.js, not browsers. |
I tried with Node.js and export function to use in Vue file but that is also not working. |
You need to create a REST API and consume the API from your Vue app. |
Closing - no activity. |
I'm getting the following error while trying to run the angular2 code. WARNING in ./node_modules/oracledb/lib/oracledb.js webpack: Compiled with warnings. Any help? |
Is the Angular 2 code client side? |
No. |
@hmrasi do some googling and debugging. You can see what line of oracledb.js is problematic. Take a look at what it is trying to do. Do node-oracledb apps work for you outside Angular? |
I'm not sure what you mean. Isn't Angular a client-side library? |
@hmrasi , you should not import oraclebd in angular code. Angular is a client side framework for web development, ergo...runs in the browser...which is not something oracledb does. |
Thanks for the reply. @danilohgds As im new to Angular2 and Node, can you please explain me a few steps regarding the solution? Thanks |
Hi @hmrasi I assume you are familiar with the concepts of backend and frontend development. Angular being frontend, it does not mix with backend libraries( oracle db ). I suggest you follow along posts from Dan on his blog ( https://jsao.io/2018/04/creating-a-rest-api-handling-get-requests/ ), where he goes about how to create a rest client, server side code to share data with frontend clients. Having done so, you should then write the http requests on angular side to call your server code, and provide you the data. Best of luck ;) |
Thanks a lot @danilohgds |
I'm in the same boat as @hmrasi and assumed node-oracledb in combination with Instant Client could do all the necessary steps to connect frontend Angular to the backend OracleDB, like web3.js does for ethereum for example. There shouldn't be the need to build a Rest API separately, as it would be much easier to just offer developers the Rest API they can use out of the box (and inside Angular, omg) rather than build an entirely separate NPM project from scratch. Just a thought :/ or as I like to say "build the Rest/JavaScript API, and they will come..." |
This project, node-oracledb, is a driver/API to connect Node.js to Oracle Database. It's designed to be low-level and expose the features of the database to Node.js developers. What you're talking about (a REST API app) would be a higher level tool that would use node-oracledb when it needed to connect to that database. Such tools already exist. See Sails.js and Loopback for examples. Oracle also provides such a tool: Oracle REST Data Services (ORDS). However, ORDS is a Java application, it runs in a J2EE app server like Tomcat, not in Node.js. See this video for an overview of the manual approach vs using something like Sails or ORDS. Every application is different and there's no one right way to do anything really. Once you get into the higher-level tools, a lot of decisions will have been made for you. Whether or not that's a good thing will depend on your app and it's requirements. |
Thanks for the resources, these are awesome! Did not know about Sails. It seems great and would definitely work as a stand alone app. The plan for now is to go from Angular 6 client-side (anticipating integrating my components into a legacy app) -> Node.js -> Oracle DB. Figuring out the best way to do it is tricky; as you said, there are many different ways to go about this. We currently use ORDS/Tomcat for other Java applications that I'm not so familiar at the moment but hopefully can get up to speed. |
I am getting Critical dependency warning while using oracledb with Bootstrap-vue. My project is not running properly with this compilation warning.
What is your Node.js version? Is it 64-bit or 32-bit? Run
version.js
from https://github.com/oracle/node-oracledb/blob/master/examples/version.jsv6.11.2
What is your node-oracledb version?
2.2
What is your Oracle client (e.g. Instant Client) version? Is it 64-bit or 32-bit? How was it installed? Where is it installed?
InstantClient - 64bit
What is your Oracle Database version?
11g
What is your OS and version?
Mac
What error(s) you are seeing?
in ./
/oracledb/lib/oracledb.js/oracledb/lib/oracledb.js42:18-44 Critical dependency: the request of a dependency is an expression
warning in ./
48:21-45 Critical dependency: the request of a dependency is an expression
The text was updated successfully, but these errors were encountered: