Unable to run ionic build (Error)

When I run ionic build, this pops up.

ng.cmd run app:build
As a forewarning, we are moving the CLI npm package to “@angular/cli” with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use “ng set --global warnings.packageDeprecation=false”.

The specified command run is invalid. For available options, see ng help.
[ERROR] An error occurred while running subprocess ng.

    ng.cmd run app:build exited with exit code 1.
    
    Re-running this command with the --verbose flag may provide more information.

This is my package.json.

{

“name”: “jom-study”,

“version”: “0.0.0”,

“license”: “MIT”,

“angular-cli”: {},

“scripts”: {

"ng": "ng",

"start": "ng serve",

"test": "ng test",

"pree2e": "webdriver-manager update --standalone false --gecko false",

"e2e": "protractor"

},

“private”: true,

“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",

"@angular/router": "^3.3.1",

"core-js": "^2.4.1",

"rxjs": "^5.0.1",

"ts-helpers": "^1.1.1",

"zone.js": "^0.7.2"

},

“devDependencies”: {

"@angular/compiler-cli": "^2.3.1",

"@types/jasmine": "2.5.38",

"@types/node": "^6.0.42",

"angular-cli": "1.0.0-beta.28.3",

"codelyzer": "~2.0.0-beta.1",

"jasmine-core": "2.5.2",

"jasmine-spec-reporter": "2.5.0",

"karma": "1.2.0",

"karma-chrome-launcher": "^2.0.0",

"karma-cli": "^1.0.1",

"karma-jasmine": "^1.0.2",

"karma-remap-istanbul": "^0.2.1",

"protractor": "~4.0.13",

"ts-node": "1.2.1",

"tslint": "^4.3.0",

"typescript": "~2.0.3"

}

}

Thank you in advance. :slight_smile:

If nothing else helps I suggest upgrading your cli for ionic and angular and start a new project

U seem to be running angular 2 which is ages ago

Also, please always post textual information as text.

In my case, run both global and local installs of angular/cli to match to npm prefix location.
My prefix path is c:/users/[my userid]/AppData/roaming/npm
After angular/cli is installed ng.cmd command should be in the prefix path folder.

After this was failed again, I tried to install angular/cli locally along with --save-dev option.
here are the example commands:

$ npm config get prefix
$ npm install -g @angular/cli@10.2.3
$ ionic serve

If failed again, try the command below because ionic cli or whatever is looking at /node_modules/.bin folder for ng command.
$ call npm install --save-dev @angular/cli@^10.2.3

In my case, remove package angular-cli and then replace it with @angular/cli works.
Or, downgrade the npm version can be used if do not want to install @angular/cli.

My prior advice is to upgrade to latest version. Tie up with latest update will remove deprecation and support errors