How do I run a copied project in Node.js - javascript

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!

Related

Node cannot find path in node_modules / 'react-scripts' is not recognized as an internal or external command

I'm on windows 10
When I run:
npm run start
or
npm start
I get an error:
npm start
> app-test#0.1.0 start
> react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
What I already tried:
npm ci
remove node_modules and reinstall project
npm audit fix
run command from elevated PowerShell (as admin)
Uninstall Node v.18 win NVM and reinstall common Node installation LTS v.16
Check if react scripts is on dependencies section in package.json - and it's of course there.
Recreate project itself and also create a fresh new React project with npx create-react-app
Clearing npm cache
Nothing's helped me.
BUT This project runs fine WHEN I explicitly tell the node path to subfolder with a script:
app-test> node node_modules/react-scripts/scripts/start.js
Compiled successfully!
You can now view app-test in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.91.1:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully
What's interesting that an old React projects also resided in the parent folder starts normally even I renew node_modules in these projects doing them npm i or npm ci
But any time I try to create and start new React app command npm start fails
UPD1: Tried to create-react-app on any other drive or folder. And it's running ok.
So culprit seems permissions policies in my common working directory ?
UPD2:
I resolved a problem though still have no clear idea who was actually the really culprit of this bug.
I copied all my parent developer folder with all code examples to another drive, then tried to create react app there and out of the blue it worked fine at then new location.
Also I removed this original folder from the drive where it used to be. And do git clone "..." at this directory< recreating the exact structure as it was before all experiments.
Then I tried create-react-app exactly at that location as I've unsuccessfully tried before swapping folders and it was OK !
Tried couple of time with different folder location within parent directory and all sill working fine now !
I remembered now I already have such bug before. And I had to reinstall Windows that time.
I also want to mention that I also have another machine with Windows, another one with Linux and had also laptop with an OSX so I can ( or could) push to this very git repository from any of these computers.
Suggestion of somebody who have any idea, why this bug was happening repeatable would be highly appreciated.
Thanks.

Javascript issue installing npm packages (nodemon, express)

I'm new to js and trying to setup a simple project with express and nodemon via npm.
However, installing these packages does give me multiple errors (see below).
I am on Win 10, using the PowerShell & Atom IDE. Project is saved on Google Drive.
"Calc.js" is simply the name of my project.
I have node & npm installed and restarted pc multiple times before.
Then I set up the npm init
I begin to install the first package and get this error:
I try to install express, but get the same result, adding -g also does not make a difference. Now I install "ci", which works for some reason.
Now I have the node modules folder in my project, try to install express again, and it seems to kinda work (got the files in the node_modules folder).
However when I try to run the calc.js via "node calc.js" it
does not work.
Already tried out many things and even accidentally made it work, then tried to reproduce it and failed. Would be super happy for some help.

Starting server - done! in IONIC 2 without run the project

I an having some little problem's when trying to command my project to run with the 'ionic serve', command, inside of the application folder. Every time that i use this command the cmd return the message 'Starting server - done!' and don't run my program.
I already tried to uninstall and reinstall my Cordova, npm and Node.js, at least five times, in each time using a different version of Node.js but without success. I tried to use gulp command in the last installation before the 'ionic serve' command, without success again.
This project of Ionic was downloaded in TFS, because my colleage create him im my enterprise and update to TFS, then i downloaded it.
Now my Node JS has the version 6.10.1 and my npm is in the version 3.10.10. I have a project to deliver in one week and are desperate to solve that.
I will be grateful for any help. Thank you everyone.
Delete the node_modules folder from your project.
Run the command npm install (It will recreate a fresh node_modules folder).
Then run ionic serve.
My friend, i solved in another way.
The person of my enterprise, who had uploaded the project don't put the node-modules folder. Than i copy the folder of him and put in my project, after i used 'ionic serve' command and everything just worked well.
Thank you for your help. I am very grateful.

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

SocketCAN in node.js

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.

Categories

Resources