Deploying Mean stack webapp on AWS - mongodb

I have created a webapp based on the the Mean Stack( MongoDB, Express, AngularJS, NodeJS). I had followed this tutorial on setting up AWS: https://scotch.io/tutorials/deploying-a-mean-app-to-amazon-ec2-part-1
I got to the point where they started their server.js file by just calling node server.js. I do not have a server.js though. In webstorm I run grunt serve and it launches everything. On aws I run grunt serve and it just says cannot find bower components. I also try to run bower install and it fails saying I do not have permission but when I run sudo bower install it says bower cannot be run with sudo.
I am not sure how to solve this issue. Should I figure out how to use a server.js?
Any help wold be greatly appreciated

You can use npm start instead of node server.js, if you have initialized the app using npm init.

Related

flutterfire configure not working even after installing via npm, and relogging

I keep getting this error no matter what I attempt to do,
I've already tried using "npm install -g firebase-tools",
and "firebase projects:list" displays a correct list of my current projects.
Looking for help as I have sunk countless hours into this problem without being able to move a step forward.
FirebaseCommandException: An error occured on the
Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it. ```
In case you have installed (and renamed) firebase.exe from the windows installer, remove that first.
The installation of npm install -g firebase-tools and the windows installer are conflicting with each other.
Then go through firebase logout and firebase login again before running flutterfire configure.
I added the firebase-tools file downloaded from https://firebase.tools/bin/win/instant/latest in the root of the directory of my project and it works for me. I changed the name to firebase only.

Actions module not found when deploying through fab.dev?

I am deploying my next.js app through fab.dev to cloudflare workers and after generating the fab.zip file I'm unable to deploy it.
Here are some of the steps you can try ,
Reinstall fab actions module
npm install #fab/actions
Make sure you are running fab in bash env or any linux env
it doesnt really work well with windows powershell

Should a vscode dev container run npm install as part of its setup?

I've created a VS Code dev container for my project. To help new contributors get started, should the dev container Dockerfile run npm install?
No. Dev container define a development environment and should not perform actions that would be part of a normal development workflow (such as running npm install).
There are a couple of reasons why npm install in particular should be avoided:
If you run npm install in the dev container Dockerfile and it fails, the dev container will fail to launch. It's farbetter if the developer can open the dev container successfully, and then run npm install in an environment where they can investigate potential failures
npm install must be re-run when the project's dependencies change. Running npm install as part of dev container setup hides this from developers.
Dev container should only use npm install to install global scripts or tools that do not belong in the project's package.json.
It is actually good practice to call npm install as part of the dev container configuration. It eases and accelerate setup of the development environment, ensuring it's ready to use out of the box without extra steps possibly missed.
Note that the npm install must be in a postCreateCommand where sources and package.json are available (contrary to the Dockerfile).
Due to the nature of docker and devcontainer, there is very little reason for the npm install command to fail and need debugging. If it ever happen, VSCode logs will provide meaningful information, otherwise the postCreateCommand can be disabled quickly to investigate the issue.
There exists an official VSCode video, so we can assume calling npm install as part of the dev setup is a common practice: How to automatically run npm install in a dev container.

sails lift - failed - how lift the app?

Hello i have a tried to lift my sails app.. but now i get this back
This is the source of the terminal. on my mac !
Space-Od-Mac-Pro:git1 cyberspace$ sails lift
-bash: /usr/local/bin/sails: No such file or directory
Space-Od-Mac-Pro:gitt1 cyberspace$
how fix that? i tried to many things install node etc.. but how can i do that?
i have tried to install noce.js and npm right? but isnt work i get this path back
how change this that i can sails lift my app.?
You would need to install sails globally to be able to run sails. npm install -g sails would install it globally but you may need to run it as sudo.

Deploying meteor app to a webserver

Does anyone know a step by step guide to deploy the own meteor app from windows to a webspace (not xxx.meteor.com).
I've found some tools like meteor.sh, but I'm a beginner and it's difficult without a guidance and without linux (needed to execute sh-files for example)
Make your project locally
Build your project locally, you could test it using meteor run or even meteor deploy xxx.meteor.com to see if its working
Bundle your app
Use meteor bundle deploy.tar.gz to make a file called deploy.tar.gz in your meteor directory containing your project
Upload your file to your server
This depends more on how your server is/what your platform is but you can use a tool to upload it for you (e.g Transmit on mac)
Install node.js & fibers on your platform if you don't have it already
This depends alot on your server platform. Have a look at http://nodejs.org/ for more detailed instructions
Extract your bundle
If on a *nix platform you could do the below in the directory where you uploaded your bundle (explanation):
tar -xzvf bundle.tar.gz
Enter the directory and install fibers
Fibers is needed for any meteor project, it helps use synchronous style code on server side javascript:
cd bundle/programs/server/node_modules
rm -r fibers
npm install fibers#1.0.1
The first line enters the directory in your bundle where fibers is installed, the second removes it, and the third reinstalls it.
Get MongoDB on another server or use a third party service like mongohq
Meteor production deployments need another mongodb. You can either install it on another server or use a third party server. It's not recommended to install it on the same server you install meteor on.
Finally check if your project is runnable
cd ../../../
node MONGO_URL=mongodb://dbuser:dbpassword#dbhost:dbport/meteor ROOT_URL=http://yourwebsite.com app.js
The first line gets you back to the bundle directory and the second runs node.js on your project with the parameters that let you connect to your mongodb database.
Install something to let it run in the background
It depends on which one you want to use, foreverjs is quite easy to use
npm install forever -g
If you get an error problem try using sudo before the npm (which lets you run as a super user).
Then you can run forever:
forever start MONGO_URL=mongodb://dbuser:dbpassword#dbhost:dbport/meteor ROOT_URL=http://yourwebsite.com app.js
And its done!
Extra notes
While its not that easy to get started from scratch this should help you get started. You still need to secure your mongodb server up if you've used your own servers.
The meteor.sh script does pretty much the same as above but very quickly if you learn to use that instead it might be faster to deploy updates
You might not have wget or a couple of commands that you might need that come up and give you Unknown command errors. Have a go at running yum or apt-get and see which one of the two you might have. You can then install the required package using one of these installer tools, i.e with yum install wget
I hope this helps you, its not that easy to deploy to a server on the first shot as a couple of things might be missing (files/packages/dependencies), you might run into other problems with permissions & stuff, but you could always ask on serverfault or here on stackoverflow on what you run into.
I recommend Meteoric.
Note, that you need to run meteoric from your development machine.
Script is self explanatory and works perfect for me.