Hi everyone I know its simple question but I am new the angular development.
I have angular projects but I cant run.
I know npm using on console, I tried many times npm run, npm instal on my main directory.
So, how can I run my angular project on the console?
If the project is using Angular Seed or is similarly configured, you can use
npm start
to install dependencies and start a running http-server on port 8080 (by default).
If you project has a README or package.json file, it might give more clues.
Otherwise you can just serve up the application with http-server:
npm install http-server
http-server .
Asume you are using NodeJS as a server side, try node [your-application-main-js-file.js]. For example node index.js. But it depends on what back end environment are you using. Angular is just a front end library/ framework. It should be tested on browser not in your console.
Related
I have a react app that I created with npx create-react-app. I have been workin on this app for a few weeks and decided to try to add a backend. I installed mongoose, express, and nodemon, and I can see them in my dependencies, but now when I use npm start, it opens up my browser and sends me to localhost:3000 but the app doesn't load. just an error saying this site cant be reached, local host refused to connect. Can anyone help me figure out how to get my app properly running again?
Try to delete node modules and install dependencies again similarly you can use npm ci will do the same.
I am new on Next JS, I have created a small application. It is using API calls and more features.
During development, Using the command as npm run build I am able to create .next folder as build and using npm run start I am able to run that build.
Now the client is asking for build, so what should I send to him? Either complete project and ask him to do the
npm run build and npm run start (which I don't think so)
or only the .next folder. But how he will run this build?
Open package.json in your editor and add the following export script to the file:
"export": "npm run build && next export -o _static"
run this code in the terminal:
npm run export
Open _static folder and there is all of your file.
Some possible ways of sharing your project:
You can easily build and host your project with services like vercel or netlify. Easy and quick. Check out the vercel CLI in particular.
Your client can clone the git repo, install all dependencies, run build, and run start. This'll start a production server. Check here: https://nextjs.org/docs/api-reference/cli#production. Bad idea if your client is not a dev.
You can build your project and send the output to your client, which he/she can then view by spinning up a server (python simpleHTTPServer, Mamp). Also a bad idea if your client is not a dev.
Long story short, host your project somewhere and send them a production URL.
I am new to node.js. I have been undergoing Angular.js Pro by Adam Freeman
As per the installation step:
I need to setup the web server for angular.js application using nodejs.
Accordingly i installed node.js version 6.11.0 in the path:
C:\Program Files\nodejs
Next step is to install connect module of nodejs using the command npm install connect.
I am getting the below error message when doing so.
shell output here
Can please anybody help with this.
You don't have to do that in the node.js path.
You can head over to a new directory say ~/desktop/temp
And then first do npm init, which would set the project to use npm. It would ask a couple of questions.
Post this, do npm install connect
Well, you need to start clean in an empty folder of your choice. This will be your project folder.
cd into it, then run npm init
Now you're ready to npm install whatever packages you need.
I'm trying to create a React project in WebStorm 2016.3.1
It's asking me for a create-react-app but I have no idea what that is and I can't find any reference on Google.
What is it and where can I find the value?
You need to install create-react-app npm module, before you use this feature.
npm install -g create-react-app
You can read more about this feature on the official release blog of WebStorm.
Excerpt from the documentation :
Make sure that you have create-react-app installed globally on your computer, for that run npm install -g create-react-app. Then to start your new project, double click on the start task in the npm tasks tool window to run it. That’s it!
I had ie installed create-react-app globally using yarn and webstorm failed to find it. Then I used npm, not to mention globally and its working like a charm.
TL;DRNo need to install anything. Just enter npx create-react-app in the create-react-app field & it should work like a pycharm, I mean charm :)
Side note: npx is pre-bundled with npm since npm version 5.2.0.
I created webStrom react app following this steps.
Download node.js
Open command line console and type "npm install -g create-react-app"
Create react app project from web-storm.
Make sure you provided the correct file path of create-react-app , by default it is
installed in ~\AppData\Roaming\npm\node_modules\create-react-app
use
npm start: to start development server
If you are using asdf or any other tool to manage multiple versions of nodejs, you will need to set up the path to create-react-app manually
I'm on mac, so for me the path was
/Users/<USER>/.asdf/installs/nodejs/12.16.2/.npm/lib/node_modules/create-react-app
I have a node API and an angular front end project (via grunt, bower, yeoman flow structure) as two separate github repositories. I am trying to push them both to production through Heroku. Coming from a rails bg where everything in the app exists in the same project directory, and you only have to push one directory, how would you do this? Should I push both projects as separate heroku projects or is there a best practice out there? I'd appreciate any and all advice, thank you in advance.
Firstly, I would review the official Heroku doc on deploying nodejs apps
If you have two projects, you will probably want to deploy them as different heroku apps.
The key here is going to be making sure your package.json is set up correctly. Make sure all your dependencies are correct and present, and your package.json points to your node server script. Make sure you have your dev dependencies like grunt separate from your production dependencies also, as these don't need to be deployed to production. If this is just a demo app, you can have heroku install all your scripts (like angular) simply by including them in your package.json. When you push your app, it will run an npm install on your package.json and install it the dependencies.
There are a few ways you can deploy also - via the heroku cli, a github link, or a dropbox link. I haven't personally used the cli much, but I have found the other two convenient to use, especially if you are already pushing to github.
One key thing too is that if you need to install dependencies with bower, you should know that heroku DOES NOT run bower install on it's own. You can tell heroku to run it by adding the following to your package.json:
"scripts": {
"postinstall": "bower install"
}
This will cause it to run a bower install after npm install finishes.
Also, if you haven't done so already, you'll need to set up your database somewhere with a 3rd party provider (like mongolab or modulus).