I'm pretty new to Angular 2 and I just started to learn it. After doing this:
npm install -g angular-cli - I couldn't find on the hard drive this folder: src/app / ./src/app/app.component.ts.
My question is - in order to open the files in notepad++ - how can I locate it on my hard drive? I looked in program files / nodejs but it wasn't there
Thanks
npm install -g angular-cli has installed the angular command line.
You don't have any created project yet.
What you need to do next is run the following commands:
ng new your-app-name // create the app with angular-cli
cd your-app-name // change directory to your new angular app
ng serve // run your new angular app
Check the official site here: https://cli.angular.io/
Related
i updated my question please help me
enter image description here
open the package.json file and change jasmine-core" 3.7.1 to 3.8 and "karma-jasmine-html-reporter" from 1.5.0 to 1.7.0 and save it in devDependancies
Then run
npm install
ng serve
If you don't have a node module folder, you have to run
npm install
command first.
If you already have node module file, you can delete the folder and then run npm install command.
If any of this does not work, you can delete the whole project folder and start from ng new.
If the issue continues, you can update the angular cli and core. Can you send a screenshot of the command prompt after running this command - ng --version ?
I am going to create an app which deals with Angular5(front-end), Nodejs(middle-end) and MongoDB(back-end).
Below is the folder structure:
Package.json: "start": "ng build & node server.js"
Now when I am start the app by npm start, It throws the following error:
"Unable to find any apps in .angular-cli.json."
I hope node server is looking for this file to load angular codes. But it lies inside angular folder.
If I place both angular and node codes in same place, it works well.
But it looks more clumsy and a bit confusing. I don't want to compromise with my folder structure.
Can anyone please help to achieve the app working on the same folder structure that I would prefer?
Thanks in advance.
it might be that your global #angular/cli installation got corrupt. You may try a cache clean and reinstall..
npm cache clean
npm -g i #angular/cli
If you use angular cli for creating the project, then looks something wrong in the package.json, (as I seen your comment on the previous answer)
first uninstall angular cli if already install by using
npm uninstall -g #angular/cli, then npm install -g #angular/cli after cli installation ng new [project name /folder name]
cd [project name /folder name]
ng serve --open
try once.
I got this same error in my current project and was confused because I'm running the application / ng serve in one terminal, but got this when I tried to generate a component from another terminal. .angular-cli.json was already there and correct. So what gives?
I realized that I used the shortcut to open VisualStudio Code's internal terminal -- which opened the terminal to the *root of the project * (like most IDEs). The project contains other things in addition to the Angular application folder that has the .angular-cli.json file in question. I just had to cd to the right folder and run ng g c again and things were fine.
In my case it was just a silly error. I thought I'd come back to share in order to save people a real headache for something so simple. I see that Shiva actually has mentioned this above, but I thought I would give a bit more detail so it doesn't get overlooked.
Reference URL: How to generate .angular-cli.json file in Angular Cli?
I'm using the following tutorial: http://jasonwatmore.com/post/2017/02/22/mean-with-angular-2-user-registration-and-login-example-tutorial
When I tried to use ng serve (instead of npm start as the tutorial suggests) I ran into the following error:
'Unable to find "#angular/cli" in devDependencies.'
Essentially I'm asking if it's possible to make this project compatible with the angular cli and if so how?
My end goal is to try and see if I could host this on heroku, and I'd like to use the "ng build" command. Is there maybe a way to get around this and host not using the angular cli?
Thank you!
ng serve is angular cli command. Angular CLI is a command line interface created for simplifying angular project setup.
Your project has to be Angular CLI project to be compatible with Angular CLI:)
Setup is very easy:
Install Angular CLI more info here. For you the one important command is npm install -g #angular/cli which will install Angular CLI globally.
Run ng new project_name which will create and setup all you need for angular 5 project (if you use the current angular cli).
From the project folder run ng serve
If you want to generate new component run ng g c component-name
If you want to generate new module run ng g m module-name
If you want to generate new service run ng g s service-name
Just re-installed Angular and started a new project using ng new, but I couldn't execute ng serve after I made the new project and cd into it. In my Mac Mini after I ng new a new project, I can just cd into the project folder and do ng serve, in my Windows 10 I need to execute npm install first cause straight ng serve gave me error.
After I checked the project folder, its because ng new doesn't make a node_moodules in the new project and download all the required packages ( ng new executed very fast ).
Based on the documentation and most setup guides out there, after ng new we can go straightly to ng serve after change the directory to the project directory. Is there something wrong with my installation ( Node, angular, npm, etc... ) or this is normal ?
https://angular.io/guide/quickstart
I use Angular CLI 1.2.1 in the Windows 10 and Angular CLI 1.2.0 in OSX.
I am doing Angular 2 and having the same issues
Everyone out there is trying to solve the issue by suggesting solutions that worked with previous versions or maybe AngularJS
Its true you have to do npm install every time you create a new project because that creates the node_modules folder
I must run micro-crawler https://github.com/WebMole/Micro-Crawler which is a crawler web application, that run with node.js.
I could not figure out how to open this app, I download node.js, and when I write install npm and install bower to the node.js command line nothing happened. Also I did not understand how to start web applicaion after installations
Please help me
Finally I solved the issue
First, I install node.js, then move node.js folder to wampserver directory,
and move the web sites files in the node.js directory
Second, I go to the path where node.js is from command line, then enter "install npm" command
line
The error appeared in this phase for solving I create a npm
folder in c:users/user_name_of_your_computer/app_data/roaming then I installed git and enter the directories of bin and cmd files of git to the system enviroments/path
Third I enter the commands "bower install" and "npm install -g grunt-cli" from the comand. from the path of where node.js is
and the micro-crawler works
Did you execute your .js file? You can do that with node.js cli thus:
path/to/your/file: node file.js
This is a good reference:
How to run a hello.js file in Node.js on windows?