1

Having issues to build my angular app with angularcli.On ng build command it shows following error. What am i missing.

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

A Sample one works well. However the old project has this issue. The old project were not created by 'ng new' the angular-cli.json and entries in package.json were added manually. Which did build for a while and with all the compatible version changes with cli, angular, rxjs and zone now it is stuck with this error

ng --version gives me the following

angular-cli: 1.0.0-beta.28.3
node: 6.11.1
os: win32 x64
@angular/common: 2.3.1
@angular/compiler: 2.3.1
@angular/core: 2.3.1
@angular/forms: 2.3.1
@angular/http: 2.3.1
@angular/platform-browser: 2.3.1
@angular/platform-browser-dynamic: 2.3.1
@angular/router: 3.4.10
@angular/upgrade: 2.0.2
@angular/compiler-cli: 2.3.1

package.json has following entries and more

"name": "project1",
"version": "1.0.0",
"description": "Application to capture info",
"angular-cli": {},
...
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
...
"devDependencies": {
"@angular/compiler-cli": "^2.3.1",

and a standard angular-cli.json

"apps": [
{
  "root": ".",
  "outDir": "dist",
  "assets": [
    "assets",
    "favicon.ico"
  ],
  "index": "index.html",
  "main": "app/main.ts",
3
  • Show your current directory in your cli Commented Aug 16, 2017 at 9:17
  • how do i add an image here Commented Aug 16, 2017 at 11:14
  • Directory of D:\workspace\code\project.Web 16/08/2017 12:35 PM 1,271 angular-cli.json 07/07/2017 04:42 PM 144,712 package-lock.json 16/08/2017 04:15 PM 2,368 package.json 16/08/2017 05:53 PM 331 tsconfig.json 22/02/2017 09:44 PM 1,896 tslint.json 22/02/2017 09:44 PM 367 typings.json 6 File(s) 150,945 bytes 0 Dir(s) 1,010,323,546,112 bytes free D:\workspace\code\project.Web>ng build --prod You have to be inside an angular-cli project in order to use the build command Commented Aug 16, 2017 at 11:24

1 Answer 1

2

You have to be inside your project directory. In terminal window, do

cd YourProjectName
ng build

You can still see angular-cli version, because you installed it globally on your computer

Sign up to request clarification or add additional context in comments.

7 Comments

Sure am trying ng build in the folder. I tried ng new project.. cd project.. Which was building, note it has the same issue
I mean "now it has same issue"
Have you deleted any files or have you done npm install?
Maybe your your local installation is failing, so please reinstall angular cli, following this steps : github.com/angular/angular-cli#updating-angular-cli
Yes I have been doing npm cache clean, npm install... did npm uninstall of angularcli globally and installed again globally. have lost count.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.