angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open WG-Com opened this issue 10 years ago • 30 comments

#i run this command 
git add *
git commit -m 'msg'
ng github-pages:deploy --message "Optional commit message"

then error to me :

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

#ng g component hello
You have to be inside an angular-cli project in order to use the g command.

.....

WG-Com avatar Jul 20 '16 21:07 WG-Com

Could you explain why this is unexpected? The cli needs to know how the project is configured.

aciccarello avatar Jul 21 '16 13:07 aciccarello

which config file ?

steps:

ng new hello  -> ok
ng g component user -> ok
ng g component .... -> ok
ng serve -> ok
ng build -> ok

git add *
git commit -m 'msg'
ng github-pages:deploy --message "Optional commit message"  -> error => github token no permission
@here looks like delete my src/ dir and many other files , my src source code lost
ng build -> error:
You have to be inside an angular-cli project in order to use the build command.
........

WG-Com avatar Jul 21 '16 14:07 WG-Com

happend again:

ng github-pages:deploy --message "msg"
(node:5689) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Built project successfully. Stored in "dist/".
fs.js:95
      throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
      ^

Error: ENOTEMPTY: directory not empty, rmdir 'next/dist/vendor/@angular/platform-browser/src/'

ng github-pages:deploy --message "msg"
ng build
You have to be inside an angular-cli project in order to use the build command.

WG-Com avatar Jul 21 '16 15:07 WG-Com

now files in projects:(no src dir and config files now )

 >ls
404.html         dist             index.html       node_modules     tmp              vendor
app              favicon.ico      main.js          system-config.js typings

> ls dist
app              favicon.ico      index.html       main.js          system-config.js vendor

WG-Com avatar Jul 21 '16 15:07 WG-Com

Hi @WG-Com, it seems like something went wrong in the deploy procedure, namely the error that you got: error => github token no permission.

Sometimes when this happens the repo is left on the gh-pages branch and you need to manually git checkout master. Your code is still there and safe.

I thought That I had picked fixed all scenarios where that happens but it seems there is at least one still. I'll try to fix it.

filipesilva avatar Jul 21 '16 15:07 filipesilva

I realize this item is about a bug, but I'd like to suggest as alternative to "The cli needs to know how the project is configured": I think it would be quite possible and useful for a subset of the CLI functionality to work on "non-CLI" project. I was recently working on such a project, and wanted to scaffold a few components. CLI could have done 90% of it for me, if CLI was willing to run on non-CLI projects. It would need to skip a few bits here and there and assume some defaults, but still more useful than refusing to run. Obviously not a priority for today... but maybe eventually?

kylecordes avatar Jul 21 '16 15:07 kylecordes

@kylecordes I'd prefer to not mix up the two things in this issue tbh, since the crux of the issue here is a bad error catcher that leaves the repo in the wrong branch and not the project restrictions. Happy to have another issue open for discussion though.

filipesilva avatar Jul 21 '16 15:07 filipesilva

@filipesilva I made #1464 a feature request for the idea above.

kylecordes avatar Jul 27 '16 15:07 kylecordes

Just a thought, how about serving directly from dist by using this: https://github.com/blog/2228-simpler-github-pages-publishing ?

intellix avatar Aug 30 '16 08:08 intellix

@intellix I was thinking about that really... it would make the process a LOT simpler. Have you checked if it also works with user/organization pages? If so, I'm definitely partial to changing it that way.

The whole thing could be rewritten with a ng build --output-path=docs --base-url=projectName this way.

filipesilva avatar Sep 20 '16 23:09 filipesilva

afraid I've never used it before, but they just posted a new blog post about it becoming even easier if it's relevant :) https://github.com/blog/2289-publishing-with-github-pages-now-as-easy-as-1-2-3

intellix avatar Dec 13 '16 12:12 intellix

After giving ng-serve

This message emerged You have to be inside an ember-cli project to use the serve command.

I have to install ember-cli?

samverneck avatar Jan 02 '17 18:01 samverneck

@samverneck no, it's just a message from ember-cli (it's the base for angular-cli). We should change it tbh.

filipesilva avatar Jan 02 '17 18:01 filipesilva

Anyone resolved this? I got the error after duplicating an ng project.

klihelp avatar Jan 18 '17 18:01 klihelp

just got this issue tonight. first it complained that it couldn't delete src because files were in use or something.

I was still 'serving' so i thought that was the culprit. I shut it down and tried to run again, then got the 'you must be inside an Angular-CLI project' error.

Running the latest everything.

randyaa avatar Jan 31 '17 04:01 randyaa

@randyaa -- I encountered the same problem today after doing a global cleanup of my node packages.

After digging into the angular-cli code, it looks like it's checking for the presence of the @angular/cli module as a dependency in your package.json. The problem of course being that, up until recently, this module was named angular-cli. So update your package.json to use the new module name/version and you should be good.

I think it'd be nice if this got fixed though, since I imagine a lot of projects are still using the old package name and the error is not super clear. I'll submit a PR if I get time.

eonwhite avatar Feb 02 '17 17:02 eonwhite

Closed via https://github.com/angular/angular-cli/pull/4385.

filipesilva avatar Feb 03 '17 14:02 filipesilva

I am also getting the same issue. As @ibwhite said that it should be @angular/cli in package.json so I have the same entry though I am getting the same error.

abhinaypandey avatar Feb 08 '17 18:02 abhinaypandey

I had "angular-cli": "1.0.0-beta.24" in my package.json and I updated it with a package.json overwrite, that changed it to "@angular/cli": "1.0.0-beta.30", which gave me this error. I changed it back to "angular-cli": "1.0.0-beta.24" and it is working again. I ended up here because of the unclear message as well.

maplion avatar Feb 09 '17 03:02 maplion

Is it right way to do. As angular cli has changed its dependencies.

On Thu 9 Feb, 2017, 8:51 AM Ryan Dammrose, [email protected] wrote:

I had "angular-cli": "1.0.0-beta.24" in my package.json and I updated it with a package.json overwrite, that changed it to "@angular/cli": "1.0.0-beta.30", which gave me this error. I changed it back to "angular-cli": "1.0.0-beta.30" and it is working again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1400#issuecomment-278536161, or mute the thread https://github.com/notifications/unsubscribe-auth/AJuOhnwFQJKiPSfF6oN2jbxN3ys2EJVCks5raoY-gaJpZM4JRPQ4 .

abhinaypandey avatar Feb 09 '17 03:02 abhinaypandey