im trying to run a node.js example project that i downloaded from here
I downloaded node.js and npm and checked both versions using CMD as seen below.
At first the version of npm wasnt compatible but i followed a youtube guide and now it seems the versions are compatible. If i didnt mention, im using Windows os.
I then installed the socket package by typing in "npm install socket.io#0.9.10 node-static" in cmd and a bunch of writing happened until it finished.
I then open cmd and do, "cd ... then the folders which contain the project" until its the root folder.
I then type in cmd "node app.js" which is the js file contained in the project.
I get this as a result:
The tutorial im following then tells me to go to http://localhost:8080 to see a local copy of the demo but when i do, chrome just loads and loads then after a few minutes says it cant be reached. does anyone know what im doing wrong? any help is appriciated
afaict you're not doing anything wrong, Doesn't work for me either. It was written in 2012 so it's quite possible this worked fine with an older version of Node.JS and older versions of some dependencies. To get it working for me locally I made the following changes:
Change the handler function in app.js to
function handler (request, response) {
fileServer.serve(request, response);
}
And instead of installing an old version of socket.io I installed the latest. You may want to delete your node_modules directory in the project and then:
npm install socket.io node-static
Related
Everytime I try to figure this out I end up on the same pages with the same confusing terminology that doesn't explain anything. This is what I have:
installed notepad++ with recommended settings.
installed 17 recommended plugins for notepad++
installed node.js and all recommended software included in the node.js lts .msi file.
step 1 of the tutorial? create a new directory for the project and use npm init inside of it so we can start keeping track of our packages. problem? I can create a new directory with ease, but where am I supposed to run npm init FROM? presumably some type of console but idk what console, I have like 8 of them after installing node.js, and none of them recognize any commands that I know. Can someone please explain this to me as if I were a 5 year old?
all you should need to do is to install node.js from the org website, from there just open cmd or terminal and not any other fancy terminals I would recommend to use VSC but that is up to you after all
if you open cmd, cd into the directory.
then npm init and follow the instructions from the terminal.
It is an expo-eject project and the commands I have used after cloning the project are:
Yarn,
Yarn start,
Yarn android,
And it does not show any error but gets stuck on a same point everytime when I try to run the project.
The project runs fine on the laptops of other teammates, but I am facing this issue.
Here are the versions of the installed tools:
Nodejs 14.17.6,
Expo 4.11.0,
React-native-cli 2.0.1,
I am adding an image that shows where the project gets blocked.
This is the issue in running project.
Had the same issue, and tried #usama-alaf reply, which consisted of:
Installing the right SDK for the Android device
Linking the SDK path under project/android/local.properties
But none of the above worked for me. Digging a little deeper, I found this Github issue from Willem Horsten, where the developer states that there was a yarn.lock file on one of his Hard Drives. I'm actually running my development environment on a secondary HD, and I also had a lock file in the root of the drive, but after deleting it, nothing changed.
Here's what actually worked for me. I was running Node v12, and trying to build the project, and trying to check whether the Node version was the culprit, I did this:
Deleted my node_modules, yarn.lock, and all other lock files I could find (for some reason there was also a package-lock.json file on the project)
Since I'm using NVM, I switched to Node v15.14.0 (the latest I have installed).
Installed the dependencies again with yarn install
Ran yarn android, and the build worked this time.
I've been creating a JavaScript game for a project recently and have done it completely on the CodePen website. I now am trying to transfer it to WebStorm to turn it into a basic website. However when I try to run my code I get the following error:
I don't know how to fix it, I've looked everywhere and haven't been able to get some help. Any information would be appreciated.
Simple one, basically the error says, I don't know how to interpret this bit of code that you just gave me. You're missing local install of Node.js and NPM. Get the latest versions of these 2, and then go to File -> Settings -> Language&Frameworks -> Node.js and NPM and in the Node interpreter text box, point it to the path of where node.js was installed.
You're running this JavaScript file with Node.js that is probably not installed on your machine. It seems that you want to run and debug your app in the browser instead. For that you need to create a JavaScript run/debug configuration instead as described here: https://www.jetbrains.com/help/webstorm/debugging-javascript-in-chrome.html
On a linux machnie,
Install nodejs and npm
sudo apt-get install nodejs
sudo apt-get install npm
Get the nodejs installation folder
whereis nodejs
Should print something like:
/usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gz
Go to:
Webstorm-> File -> Languages & Frameworks -> Node interpreter
Copy paste the installation folder to the text box.
Mac OS here. Solved the issue with:
$ brew install nodejs
I'm trying to simply install a stupid package in Node. I use the normal ol' command and it proceeds to tell me it can't find a file or directory (see image below). I've already updated and reinstalled npm, and still the same thing. I'm also running Windows 8. Any ideas, please?
Should I give up developing Node on a Windows machine?
Thanks!
Run npm init first and it will create the package.json file that it is looking for.
I am new to node.js,today I joined in another team they are working with node.js,backbone.js,marionette.js and sqlserver.I have an idea about backbone,Marionette but I never work on node.js.They asked me to clone the git repository,As per their suggestion I installed node.js.
After cloning the repository,I got the files just in the following way.
I opened node_modules folder,It has nearly 10 sub-folders are there.
node-sqlserver doesn't have any files inside.might be because of that I am getting the following error while server running time.
I ran the server with the following command
node server.js local
getting the following error
I don't know,why I am getting.can anyone help me.
Thanks.
You need to install all the dependent modules through npm install, In your case, you need to install node-sqlserver.
npm install node-sqlserver
Generally your source code will be having a package.json. This file specifies all the
dependent modules required to run the application, but here this file is missing.