SocketCAN in node.js - javascript

I use ARM board with embedded Linux on it, but it is very limited. Somehow I managed to install node.js and npm. The idea is to send data via CAN bus on button click event from the web page. I have found only one module called "socketcan", but I cannot install it due to following lines:
npm install -g node-gyp
node-gyp configure && node-gyp build
My board fails to execute the first line, that means I can't use the only found CAN tool for node.js.
Is there any other possibility to read and write messages on CAN bus from node.js?

Socketcan doesn't work on the lattest Nodejs. I've got the same problem. Just install a Node.js version 0.10.x. For the arm7 you can get it from this page :
Conor O'Neills Page: http://conoroneill.net/
Thanks to Conor O'Neill you can download it on his Page and install socketcan without getting any errors. At the moment, I am struggeling how socketcan works in express-generate. So if someone has clue. I would appreciate it.

Related

Does node-gyp come with npm?

The issue I am facing is npm install locally doesn't give much output with npm v6.14.9 but when deploying to server it gives some meaningless output like
gyp info spawn args ['some properties about Release']
make: entering directory 'directory'
and then goes tonns of output about node-gyp and .cpp files which does not exist in my project. My goal is to remove those outputs. Just FYI installation always successful.
node-gyp is a vital part of npm.
Some npm packages come with native, not Javascript, code inside them. node-gyp's task is to compile that code and make it available for use on your machine. The code has to be compiled because the package author doesn't know whether you'll run your code on MacOs, Windows, Linux, or whatever OS, and the runnable code differs between those systems.
node-gyp isn't a lightweight tool. It needs python and the C++ toolchain. But, if you use a package that needs it, you need it. lzma-native is one such package. Various image-handling packages also need it.
If you don't want to use node-gyp you must remove the package that uses it from your project.
It's good your npm install is successful. If it weren't you would have a challenging troubleshooting task ahead of you.
Pro tip think of your nodejs project as flowers scattered in a river. The flowers are your code, and the river is your packages, the nodejs runtime, and the browsers you use. "Hey, this is wet! I want it dry." is usually not a helpful way of understanding things.

How do I run a copied project in Node.js

https://github.com/gleitz/mahjong
I want to run this app on my windows,
the directions say:
-Install dependencies with npm update
-Start the application with node app.js
it's sound easy so I try myself.
1.Fist of all , I install node.js on it's official website (https://nodejs.org/en/)
I download the 8.9.3 version.
after installing node.js
2.open the command line and go to the project path.
3.then I input the command npm update.
it works,and the node_modules folder is created.But there are some warn message
4.finally input the command node app.js... it's not work with many error message
following is wrong message
I wonder know how should I do.Is any thing I didn't installed?
Please help me.I really want to research this mahjong project.
Before running npm update in the directory where you have your project, you should run npm install first to install all the required dependencies needed for the project to run.
So I advice to delete the node_modules directory that was created after you ran npm update, after which you can then run npm install. This should solve your issue.
Update: If you just want to try it online and not run it locally they've hosted a version on the web: http://gleitzman.com/apps/mahjong.
It's not your fault.
What you did was correct, but the project documentation needs to be updated. It's not a turn-key solution and you'll need to figure a few things out to get it working.
The error message is says it wants a mongo db instance, but you don't have one running. Try the mongodb home page or google for instructions. If you have docker it is pretty easy: docker run -it -p 27017:27017 mongo.
Even after spinning up mongodb I wasn't able to get the app to work locally. You could try contacting the repo maintainer for assistance. They may be happy to help given you've shown interest in their project.
Good Luck!

Cannot run globally installed node modules in Windows 7

Note: I have tried almost all similar posts related to this issue and found nothing was helpful to me. Hence posting this.
Issue: I'm trying to install http-server package in my Windows 7 machine using npm install http-server -g, Installation was fine, however when I try to execute it using http-server command in the command line I'm getting an error saying, 'http-server' is not recognized as an internal or external command, operable program or batch file. I have also tried the same steps for gulp and the result was the same.
I have tried setting the Node Path as, set NODE_PATH=%AppData%\npm\node_modules; but no luck.
Can someone shed some light here?
Thanks,
Dave
Global packages needs to be installed using and administration console (CMD / Run as Administrator)

How to run a Node.JS app that is forked from github?

Before I say anything else, I am a complete noob to node.js and I just want to see what this web application looks like. I noticed this project at a hackathon and I wanted to test it out. They gave the github repo: https://github.com/android-fanatic/Web But I can't run it from my computer. I understand that I would need to use the command prompt and run it from my local server, but can someone give me step by step directions for installing the node.js app?
Again the link is:
https://github.com/android-fanatic/Web
Thanks in advance for any help! :)
Install Node.js
Clone the repository to somewhere on your hard drive
Open a command prompt and go to that directory
Type npm install to install any dependencies
Type npm start
???
PROFIT
The reason you can use npm start is because if you look inside of their package.json file you'll see a "start" option under "scripts". That command will execute when you type npm start.
Assuming you have node and npm installed on your system, you should be able to do:
npm install
npm start
The first command will install the node package dependencies and the second will run the server.
Note: I have never used this project, so my guess is based on looking at the repo alone.
The web application should be available at:
http://localhost:3000

Installing Node.js ./configure make sudo make install

I am currently trying to download node.js. I have downloaded everything and am now at the part where I enter the console commands.
What I am entering:
cd node
./configure
make
after entering ./configure, i get this error
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer director /Library/Developer/CommandLineTools' is a command line tools instance`
I'm not sure what this means. After entering make, i then get this repeated in a infinite loop in the console
http://pastebin.com/YrDs2Afw
in general it's a good rule of thumb to provide a bit information about what you already tried and on what system you are - especially when you are having issues with installing something.
I'll just assume, that you're working on a Mac.
I would recommend to download and install XCode as Quentin already recommended.
You can find it in the AppStore.
Once that done, make sure to install the "Command Line Tools" within XCode.
Now you have several options:
- Install Homebrew and install NodeJS from there (google Homebrew if you don't know what it is)
- Download and execute the Node v0.10.26.pkg (current version as of writing this), which will take care of the installation for you.
Hope this helps

Categories

Resources