angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.36k stars 6.74k forks source link

You have to be inside an angular-cli project in order to use the build command. #1189

Closed prashant162 closed 8 years ago

prashant162 commented 8 years ago

After npm install, i ran this command.

But it shows me the "You have to be inside an angular-cli project in order to use the build command."

Although i have installed the angular CLI globally.

Please provide any solutions to run this project so that i can see the material components on the page.!!

Thanks, Prashant

richavyas commented 8 years ago

It's not very evident from the above comment that which specific command is giving this error so this answer is based on assumption that you are running ng serve outside the root folder/actual project folder. That's why it's giving error because cli commands require conf & build files to run the cli build.

These should be the steps: npm install -g angular-cli ng new projectname cd projectname ng serve open http://localhost:4200

prashant162 commented 8 years ago

Hi Richavyas,

Thanks for reply.

Below are my steps for setting up the material2 project in my local:

  1. I cloned the repo https://github.com/angular/material2
  2. After cloning the project in my local i did "npm install".
  3. Then i did "ng build".

On "ng build" it is giving me the error "You have to be inside an angular-cli project in order to use the build command." Event i have installed the angular CLI globally.

Then just for tying i also did "npm install angular-cli" at the root of the project with admin priviledges command prompt.

after that i did "ng build". but no luck.

all i am following is from https://github.com/angular/material2/blob/master/DEV_ENVIRONMENT.md

I wanted to see the angular components running on the page.... so that i can understand how components are built.

Let me know if you need any inputs from my side.

m0t0r commented 8 years ago

@prashant162 material2 was migrated to gulp over angular-cli (#948). DEV_ENVIRONMENT.md has outdated information. If you just want to preview material2 components, you can check sample material2-app project.

jelbourn commented 8 years ago

Yep, that doc was overlooked when we changed up our build. Fixing in #1198

prashant162 commented 8 years ago

@jelbourn / @m0t0r i am successfully able to run the project material2-app. Now i wanted to create my own components for angular material2. So all i wanted to reverse engineer the button component (Just for learning purpose). But i was not able to find the Typescript code written for it.

I was able to find that we had components is the node_modules/@angular-material2 folder.

But there was only javascript code, instead of typescript code.

So where can i get that typescript code for the button component which gets compiled into the javascript code.

Please correct me if i am wrong.

Thanks,

prashant162 commented 8 years ago

@jelbourn & @m0t0r

I was messed up with CLI therefore it was not working then i followed the documentation updated by you.

Now its working!!

Thank you so much guys ;-)

chriscurnow commented 8 years ago

You guys are really trying to mess with our heads:)

I really do understand everything is moving quickly and that's what we get when we want to use beta software. So i'm not being critical – just trying to tell you what it's like from my end.

I did everything above and then tried gulp build:components

and got the result:

No gulpfile found

On a broader issue, my head is spinning at the moment.

First we had Angular2

Then we had Angular-cli.

Then we had Angular-cli with Webpack.

Now you guys are saying you've migrated to gulp over cli???

jelbourn commented 8 years ago

@chriscurnow this is talking about out internal build for the library (for contributors), not what consumers of the library would use.

chriscurnow commented 8 years ago

@jelbourn I really appreciate your prompt response. Sounds like you might be working late:)

OK, thanks that clears that up. But I still have problems.

I just forked the material2-app project and cloned it. When I ran ng serve I got a whole stack of broccoli errors!!! Eg:

/Projects/web-apps/material2-app/tmp/broccoli_type_script_compiler-input_base_path-gJvf6dfg.tmp/0/src/typings.d.ts (1, 1): File '/Projects/web-apps/material2-app/tmp/broccoli_type_script_compiler-input_base_path-gJvf6dfg.tmp/0/typings/browser.d.ts' not found. at BroccoliTypeScriptCompiler._doIncrementalBuild (/Projects/web-apps/material2-app/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:120:19) at BroccoliTypeScriptCompiler.build (/Projects/web-apps/material2-app/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10) at /Projects/web-apps/material2-app/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21 at lib$rsvp$$internal$$tryCatch (/Projects/web-apps/material2-app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/Projects/web-apps/material2-app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17) at lib$rsvp$$internal$$publish (/Projects/web-apps/material2-app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1019:11) at lib$rsvp$asap$$flush (/Projects/web-apps/material2-app/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

jelbourn commented 8 years ago

@chriscurnow material2-app is unfortunately a little out of date now; I was on vacation when RC6 and alpha.8 came out and haven't gotten to updating it yet. Will hopefully have a chance in the coming week

chriscurnow commented 8 years ago

@jelbourn – no problems. I just found this useful resource: Angular CLI Meets Webpack (and Material)

nbora98 commented 7 years ago

Hi @prashant162 , If you still have the same issue, may be the below solution could help you out: Step 1. Run this command on root folder [npm install -g angular -cli] Step 2. Create new folder for your project [ng new project_folder_name] Step 3. Enter inside that folder [cd project_folder_name] Step 4. Run the project by this command [ng serve] (Note: Now on localhost:4200, the demo project will run) Step 5. Copy the '/src' folder of your existing project and replace with the '/src' of your newly created project from Project's root folder only.

Do let me know if you have any confusion.

rjdugar commented 7 years ago

Error: ENOENT: no such file or directory, stat 'D:\sandbox\sample\src\tsconfig.json' i am getting this error

Mochoa92 commented 7 years ago

Hi everyone,

recently i cloned a repository from bitbucked made by myselft in angular 2, but after clone i executed npm install, and install modules but when i try to run "ng serve" tell me:

you have to be inside an angular-cli project in order to use the serve command

in the machine where was created works very well

shriramdevanathan commented 7 years ago

I have a feeling the local angular-cli version and the global angular-cli version need to be the same. Installing the same angular-cli version globally did the trick for me

codebryanc commented 7 years ago

You have to be inside an angular-cli project in order to use the serve command. my error!!!

jelbourn commented 7 years ago

This project hasn't used Angular CLI for almost a year now. See https://github.com/angular/material2/blob/master/DEV_ENVIRONMENT.md