Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
WG-Com opened this issue Jul 20, 2016 · 30 comments
Closed
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@WG-Com
Copy link

WG-Com commented Jul 20, 2016

#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.

.....
@aciccarello
Copy link
Contributor

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

@WG-Com
Copy link
Author

WG-Com commented Jul 21, 2016

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
Copy link
Author

WG-Com commented Jul 21, 2016

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
Copy link
Author

WG-Com commented Jul 21, 2016

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

@filipesilva
Copy link
Contributor

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 filipesilva self-assigned this Jul 21, 2016
@filipesilva filipesilva added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Jul 21, 2016
@kylecordes
Copy link

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?

@filipesilva
Copy link
Contributor

@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.

@kylecordes
Copy link

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

@intellix
Copy link
Contributor

intellix commented Aug 30, 2016

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

@filipesilva
Copy link
Contributor

@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.

@intellix
Copy link
Contributor

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

@samverneck
Copy link

samverneck commented Jan 2, 2017

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?

@filipesilva
Copy link
Contributor

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

@klihelp
Copy link

klihelp commented Jan 18, 2017

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

@randyaa
Copy link

randyaa commented Jan 31, 2017

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.

@eonwhite
Copy link

eonwhite commented Feb 2, 2017

@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.

@filipesilva
Copy link
Contributor

Closed via #4385.

@abhinaypandey
Copy link

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.

@maplion
Copy link

maplion commented Feb 9, 2017

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.

@abhinaypandey
Copy link

abhinaypandey commented Feb 9, 2017 via email

@abhinaypandey
Copy link

abhinaypandey commented Feb 9, 2017

@maplion I tried that but it's asking me to select versions below 1.0.0-beta.28.3. It says could not find specified dependency.

@maplion
Copy link

maplion commented Feb 9, 2017

@abhinaypandey I ran an npm install -g @angular/cli and an npm install @angular/cli and it seems to be bundling/compiling again as intended with the new format "@angular/cli": "1.0.0-beta.30".

Note: I did have to rename / delete my node_modules folder and redo an npm install in order to clean up some other errors I was getting after the change.

@plastikaweb
Copy link

plastikaweb commented Feb 9, 2017

I just run into this problem,
Fixed updating angular-cli in this way:

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest

No need to delete the node_modules folder

@dinhkk
Copy link

dinhkk commented Feb 10, 2017

I have tried @plastikaweb 's instructions, but not successed

@plastikaweb
Copy link

mmm @dinhkk have you tried to run ng init after that?

@JGdijk
Copy link

JGdijk commented Feb 16, 2017

@plastikaweb solution worked for me after changing my package.json, angular-cli.json and running ng init after that.

@nbora98
Copy link

nbora98 commented Mar 6, 2017

Hi ,
Try the below solution may be it could help.
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.

@seize11
Copy link

seize11 commented Mar 22, 2017

@nbora98 hey ,Your last sentence blind my dog's eyes

@WG-Com
Copy link
Author

WG-Com commented Mar 22, 2017

@seize11 你亮瞎了我的狗眼

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

No branches or pull requests