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.
Related
I will preface by saying I am a complete beginner at coding, and I signed up for the free trial of Pluralsight. I have spent the last four hours trying to get the very first project set up, as I have a mac and very few of the commands recommended by Pluralsight work on this computer. The project, cloned from git, is called web-dev-starter. Currently, I am trying to connect the Node packages needed for the project using the command
web-dev-starter> npm install
This returns
zsh: command not found: web-dev-starter
I have tried a lot of things and nothing works. Many thanks to whoever can help, I really want to learn to code and am considering buying a windows computer because trying to learn on a mac has been a nightmare! Thanks!
web-dev-starter> means the current directory from the file that you just clone. and after you are in that directory you just need to do npm install
Is it possible to run a JavaScript file with node.js on windows? I have been trying to for hours and can't find any more solutions on the internet that work.
I have a js-file that uses scribbletune which only works with node.js.
I have node.js installed and I installed gitbash because it was recommended in a forum.
I tried to run from command prompt and gitbash but nothing seems to happen.
What am I doing wrong? Any help would be very much appreciated.
There is no need to install gitbash to use Node on Windows. It's a handy thing to have if you're used to a *nix environment. If you're not, it just gives you something more to learn, which isn't helpful if you're already in the middle of trying to learn Node.
Just:
Get the Windows installer from https://nodejs.org/en/download/
Run the Windows installer
Create a directory for your project
Open a Command Prompt Window to get a command line
Switch to your project directory
(Optional, but a good idea) Use npm init to create a package.json file (it'll walk you through it)
Install any libs you're going to be using via npm (for instance, npm install scribbletune from your command prompt window)
Put your JavaScript files in that directory
Use node main.js at the command line to run your main file (whatever it's called; main.js is just a placeholder)
Inorder to run a js (java script file) file
step 1. u need to go to the file location where u want to run.
step 2. just use "shift +right click".
u will see a pop-up and go to powershell or cmd.
step 3. type "node FILENAME.js"
final step: you will see the result ^.^
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
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
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.