2

I am using Angular 5 ,bit-bucket ,azure app service and I have setup continuous integration with bit-bucket and Azure deployment option.

Please find following details

enter image description here enter image description here

enter image description here enter image description here

Project structure

enter image description here

My package.json

{
  "name": "vaquarkhana-poc-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build –prod ",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "npm run build"
  },
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.10",
    "@angular/cdk": "^5.2.5",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/flex-layout": "^5.0.0-beta.14",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.5",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.4",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "angular-ide": "^0.9.41",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

Question : I don't want to add any build dependency folder into bit-bucket like

  • node_modules
  • dist

Since Azure build package.json during continuous integration however my build is keep failing during deployment .

Logs :

'ng' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! [email protected] build: `ng build –prod `
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is most likely a problem with the vaquarkhan-pos-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng build –prod 
npm ERR! You can get their info via:
npm ERR!     npm owner ls vaquarkhan-pos-app
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\local\AppData\npm-cache\_logs\2018-07-21T05_08_50_688Z-debug.log
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\10.6.0\node.exe" "D:\Program Files (x86)\npm\6.1.0\node_modules\npm\bin\npm-cli.js" install --production
An error has occurred during web site deployment.
Invalid start-up command "ng serve" in package.json. Please use the format "node <script relative path>".\r\nMissing server.js/app.js files, web.config is not generated\r\nnpm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\0.10.28\node.exe but npm is using D:\Program Files (x86)\nodejs\10.6.0\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.\r\nnpm WARN invalid config loglevel="notice"\r\n'ng' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n\r\nnpm ERR! [email protected] build: `ng build �prod `\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the [email protected] build script.\r\nnpm ERR! This is most likely a problem with the vaquarkhan-pos-app package,\r\nnpm ERR! not with npm itself.\r\nnpm ERR! Tell the author that this fails on your system:\r\nnpm ERR!     ng build �prod \r\nnpm ERR! You can get their info via:\r\nnpm ERR!     npm owner ls vaquarkhan-pos-app\r\nnpm ERR! There is likely additional logging output above.\r\nnpm ERR! System Windows_NT 6.2.9200\r\nnpm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"\r\nnpm ERR! cwd D:\home\site\wwwroot\r\nnpm ERR! node -v v0.10.40\r\nnpm ERR! npm -v 1.4.28\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! [email protected] postinstall: `npm run build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the [email protected] postinstall script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     D:\local\AppData\npm-cache\_logs\2018-07-21T05_08_50_688Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\75.10629.3460\bin\Scripts\starter.cmd deploy.cmd

I am wonder if anyone faced same issue and resolved ?

2
  • Make sure you’re running Node 6.9 or higher, if not then you need to update and problem will be resolved Commented Jul 21, 2018 at 16:07
  • If you see my package,json , i am runing on 6 and above "engines": { "node": ">=10.0.0", "npm": ">=6.0.0" }, Commented Jul 21, 2018 at 19:33

1 Answer 1

6

Tow points to fix

  1. I see node -v v0.10.40 in your error message, which is caused by invalid node version in Application settings. Set WEBSITE_NODE_DEFAULT_VERSION to 10.6.0 which is the only version available on Azure that matches your requirement.

  2. Deployment with bitbucket makes your code built by Kudu, which requires your angular related modules in devDependencies to be installed on Kudu as well, need to copy them to dependencies.

enter image description here

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

3 Comments

WEBSITE_NODE_DEFAULT_VERSION =10.6.0 where should i add this , in package.json i have added }, "engines": { "node": ">=10.0.0", "npm": ">=6.0.0" },
@vaquarkhan See my screenshot, the setting in package.json can't modify web app environment settings.
Thanks for quick response ,building now ,will share results soon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.