I'm working for a public library in my town, and I have developed a web application to handle the borrowing process and other administration problem. A few years ago, the library bought and attached the books in the library with a RFID tag, and with it, also bought a RFID Reader to be used in the borrowing process, and a RFID Sensor Security Gate, to prevent the books from being taken out without proper administration process. For the RFID Reader to be used, the vendor gave me a JAVA applet to connect the RFID Reader to my web application, as it's not possible to access a device from the web with just Javascript or JQuery.
Currently, the library is asking me to develop a kiosk application for the library's self service center. I currently developing the kiosk application with Node JS, and I managed to create the user and password authentication with native Javascript and AJAX function.
However, problem occured when I tried to use the RFID Reader to detect the books. I tried using some modules called node-hid, but everytime I run the application, it gave me an error message.
I used:
Windows 10
Node v10.16.3
npm v6.9.2
Electron v5.0.6
Some poeple in the forums recommended to rebuild and reinstall the module and the node, but it's not working for me. Others told me to downgraded the Node or the npm using nvm, but from what i read, nvm only worked for Linux. Honestly, I'm still new in Node JS, and I'm a little bit confused: regarding the error message above, which one is actually the problem? The Node version, or the npm version?
Struggling, I tried to forget about using modules about RFID, and start from the scratch by detecting devices connected on USB first, so I use serialport module, but the same error persist.
I expected to be able to read the books' ID from the RFID tag, and rewrite some blocks in it to prevent the alarms from the RFID Sensor Security Gate goes off.
Any supports regarding the error above, or a recommendations to use another module will be appreciated. I'm at the end of my rope here.
I know this is a bit late but I'm putting it here just in case someone passed by it.
You are getting this error because you are using a native module which is ok for node, but because electron is a modified node, so in order for thhat to work: you need to rebuild for electron instead:
Add the electron-rebuild package
npm i -D electron-rebuild
Remove the node-modules folder, as well as the packages-lock.json file.
Run npm install to install all modules.
Run ./node_modules/.bin/electron-rebuild or .\node_modules\.bin\electron-rebuild.cmd for Windows to rebuild everything.
Related
I have a Node.js API on a Windows computer without internet access and I need to access data from a Microsoft SQL Server database. I have the module "mssql" however I need to use Windows authentication. I found online that this method requires the module "msnodesqlv8," however when I install the module on an internet-connected device and then move the files onto the non-internet device, the module won't run. The error I receive when I run the API indicates that the module needs to be rebuilt. Whenever I run "npm rebuild," the build attempts to install the dependencies - which of course is not possible without internet.
To try to circumvent this issue, I removed the dependency list prior to rebuild, but the rebuild still snags trying to install "safe-buffer." I don't know where this install is getting triggered. When I search for "safe-buffer" in the project, no references to "safe-buffer" are found. My assumption is that a dependency is trying to use it and I have not skimmed through every dependency yet.
I also tried packing the "msnodesqlv8" module, then installing it from the .tgz file, but this produced the same errors.
One avenue I have not yet tried is packing the module on the internet device, then transerfing the .tgz file.
Any recommendations would be awesome - I am blocked until I can solve this issue.
I was able to solve this problem by downloading a prebuild from the Github releases. I noticed in the stack trace of the rebuild that the process was accessing a specific build from this link, so I moved it into the "prebuilds" folder where it was expecting it, and the module powered up on the next rebuild.
This process has to be replicated on every device, from workstation to servers, but it works. Just make sure you download the build that matches your system.
For my understanding, node.js is a javascript-engine which is running javascript-code without using a browser(window-global). You can use javascript on a server. But I saw now a lot of tutorials(react, angular, vue etc.). In every tutorial, I have to install something with npm. I can follow there are several dev-tools which I can use on my local machine to minimize my javscript-files or compile sass to css. But in the end, when I put my files on a webserver, I just have normal javascript-files, css-files etc. No node.js code in it, right?
My question is: React, angular, vue.js etc. are written in just normal javascript without node.js right? The reason why I use npm ist just to install every dependencies with one command, right?
A question more: Is there an any recommended order to learn all these frontend-development stuff? There are so much words I have to google it: angular.js, react, vue.js, vanilla.js, typescript, backbone.js, bower, grunt, webpack, yarn etc... I dont know where I start, so I look into few tutorials, but everytime I go through these tutorials, there is a new word(technology) I have to research.
I think you're getting your terminology a little muddled.
Node.js is a JavaScript runtime, built on Google Chrome’s V8 JavaScript engine. However, that is not to say that Node programs are executed in a browser. They aren’t. Rather, the creator of Node (Ryan Dahl) took the V8 engine and enhanced it with various features (such as a file system API and an HTTP library) to create a program we can use to execute JavaScript on our computers.
Node comes bundled with a package manager called npm which you can use to install packages (such as React and Angular) from the npm registry. These packages are indeed written in normal JavaScript (or a language that compiles to JavaScript, such as TypeScript).
The reason why I use npm is just to install every dependencies with one command, right?
Kinda. You can certainly use npm to install dependencies. However, it does a lot more that that. For example you can use npm scripts to carry out various build tasks, or you can create a package yourself and use npm to publish it to the registry.
A question more: Is there an any recommended order to learn all these frontend-development stuff?
As with everything, it depends. What are you trying to build? It's relatively pointless to learn about Node, npm, React and Angular if you are attempting to build a simple static website. If I were you, I'd define a clear goal and set about learning the technologies you'll need to reach that goal. Saying that, if you are doing anything with front-end development, learning about npm will be a good use of your time.
Here's an article by way of further reading that explains things a little more: https://www.sitepoint.com/an-introduction-to-node-js/
I am still new to the electron ecosystem and desktop development in general but what I wish to do is to interface with a third party, open source application that comes bundled in with my software. First, I am unsure on what the package options to distribute should be. Is it customary to have two downloads, one for users that already have the third party binary installed, and another one that includes it? Also how do I go about actually packaging, and installing the binary? Should this be an option on my package.json? What kind of script should I execute? Are there any npm modules to facilitate this?
edit - is it possible to invoke npm from my main.js even though a user has not previously installed node? I know node is bundled with the electron package but is npm too?
-The binary in this case is PostgreSQL
There are a couple of options coming to my mind.
Bundle a 3rd party installer w/ your app. This is what I did recently. On the first run I check if the service that I need is installed / running and if not I call the 3rd party installer / start it. When the installer quits I simply app.relaunch() and start consumig it. Of course you'll need installers for each platform you plan to support. And you'll have to figure out ways to check if the software is installed (properly) for each platform.
Bundle binaries w/ you app. Of course you can bundle pretty much anything w/ your electron app. Again, you'll need binaries for each platform you plan to support. And of course they shouldn't be linked to anything that the default user doesn't have on his machine like SDKs and additional headers ...
Less comfy but you can alway add some start-up message or before-download massage telling the user that he needs software xy in order to run your application.
Derivate of 1/2: Download required stuff on demand. For your example this would mean checking the user's OS and arch and then just download the required installers or binaries if available. You could also build the stuff on the user's machine although this probably being the worst/biggest/most complex solution.
Then there's things like https://www.npmjs.com/package/pg - you should always check npm if someone already built what you need ;)
I'd recommend using the great electron-builder which makes bundling stuff w/ your app a piece of cake.
Feel free to comment if you need more intel.
When trying to add a Node Module over the Plesk JXcore Interface it fails with the message.
I can't even access the jx command over SSH.
error: Cannot install sails module. Wrong user id of the command.
Today, early morning, new version of JXcore support Plesk's extension was published: 0.2.0.
Among many things there are some improvements related with NPM modules installations, also your case with "Wrong user id of the command" was taken care of. This wasn't a bug actually. Rather a result of redundant permission check and you were the first to encounter this.
Also there is a new feature which allows to enable/disable JXcore support for entire subscription or all of them at once.
this might be a bit of a silly question but it's something that i've been struggling to find the answer to and for some reason it doesn't seem to be evident from the tutorials and websites i have been reading, so maybe it's something that is assumed that i'm really missing.
So anyway, i installed node.js and then used the command npm install socket.io. it them proceeds to download and install a bunch of files, i don't see any error with this process in the command line.
So now i've tried to access socket.io like this:
<script src="/socket.io/socket.io.js"></script>
Like it shows on the socket.io website, however i get an error saying the file isn't found..... my first guess is that the installation of node.js and stocket.io are both on the local machine (program files) and not in the htdocs.
I have tested this one two platforms, first was my localhost which is Windows 7 running XAMPP on it, and i installed node.js and stocket.io globally (Program files). Second was my Windows server that uses IIS still get the error.
So my question is, how do i reference the stocket.io API and start using it based on the installations i have?
Thanks for your time.
npm isntall socket.io installs Socket.IO in a local node_modules folder so that the library is accessible to you in your own Node.js applications. You still need to create (and run) a Node.js application that loads up the module and sets up an HTTP server that uses the module; the examples under How to use in the project readme is a good starting point, although preexisting knowledge of Node.js will be helpful. You might check out Node.js Tutorial with Socket.IO if you're looking for additional information.