Errors when I run NPM start - javascript

I am working on building a RESTful API using Node, express, and MongoDB.
During the beginning stages of this project, when I attempt to run the "npm start", I get a few lines of errors.
The errors I'm getting
I'm not sure what the problem could be as I have added the "start" under scripts in the package.json file and I have initialized node and well as having installed nodemon. Please may I ask for assistance?

Try the following:
Make the file index.js
Try the command node app.js, if it works then your node_modules is in the wrong place or you dependencies are probably not installed properly.
Try uninstalling and installing dependencies.

Related

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.

'rollup' is not recognized as an internal or external command

I would like to ask if how should I fix this issue because I am already stuck and confused about this part. I already installed rollup globally using this command
npm install --global rollup
However when I tried to run the 'rollup' command then I should expect the rollup information or something will show in my CLI? but my CLI shows
'rollup' is not recognized as an internal or external command,
operable program or batch file.
What I have done so far is.
Updated the NPM
Reinstall the rollup globally.
I already read some documentation but the issue is still showing.https://github.com/Esri/ago-assistant/issues/176
Please enlighten me.
Thank you
What I just have done just to run the script globally.
I just added these scripts in my package.json to run the rollup using NPM.
"scripts": {
"rollup": "rollup"
is this okay?
Try restarting your terminal
Try locating where the Rollup binary is installed
%AppData%\npm\node_modules or %AppData%\roaming\npm\node_modules
and run it manually like
%AppData%\npm\node_modules\rollup\bin\rollup.exe
npm install
fixed this issue for me

Nodemon not working on new project with express

I have a new project folder configured and running with express.js and the server is running fine on port 3000.
I have installed nodemon globally using the sudo command so I expect I don't need to add this as a dependency or locally within the project.
When installing nodemon there are no errors, however when i fire the command nodemon server.js the command line essentially doesn't do anything and stops accepting commands.
I'm wondering if I'm missing something and hoping someone can point me in the right direction.
Thanks in advance for your time.
Use npm install -g nodemon this command to install nodemon globally and try to run nodemon [your node app]. For better understanding go through link.
Evening all, thanks for your contributions earlier, essentially things were mixed up with the course since the updates which was causing my issue.
Previously it looks like you would install express and run server.js through your designated port and then boot up nodemon. This no longer works and was causing the issue I was having.
Now you simply just boot up nodemon via the command nodemon server.js and it handles the rest. This wasn't really outlined in the documentation.
I was expecting to boot up localhost and then use nodemon to watch for changes. Looks like the new method is much more efficient
Thanks for the help

Getting Node Module Error (Cannot find module)

I am learning the Automated tests by using selenium web driver + Javascript and node.js.
Everything is working fine when I ran that script.js from the Visual Studio code terminal(by using node main.js)
Problem
I want to schedule this script in the scheduler which automatically tests the login functionality. But when I try to run it from the task scheduler then it gives Error: Cannot find module
Does anybody know how to get rid of this.
To fix Cannot find module errors, install the modules properly by running a npm install command in the appropriate directory as your project's app. ... or delete the node_modules folder and package-lock. json file and re-install it again using the npm install command.
rm -rf node_modules package-lock.json

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!

Categories

Resources