can someone help me in this issue?
I am getting the '[launcher]: ChromeHeadless have not captured in 60000 ms, killing.' when the pipeline (Jenkins) is trying to exec the tests with karma (Puppeteer using ChromeHeadless)
We have as demmand of the client to change the launcher from Phantomjs to ChromeHeadless;
We've tried a lot of things and nothing works until now and i have no idea how to solve it.
some informations about the project configurations:
We use angular 7, karma dependencies and puppeteer as follow :
package.json
{
"name": "xxxxxxxx",
"version": "0.0.0",
"license": "my",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test -c karma.conf.js -cc --browsers MyChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e"
},
"dependencies": {
"#angular-devkit/build-angular": "^0.13.9",
"#angular/animations": "7.2.15",
"#angular/common": "7.2.15",
"#angular/compiler": "7.2.15",
"#angular/core": "7.2.15",
"#angular/forms": "7.2.15",
"#angular/http": "7.2.15",
"#angular/platform-browser": "7.2.15",
"#angular/platform-browser-dynamic": "7.2.15",
"#angular/router": "7.2.15",
"#ng-bootstrap/ng-bootstrap": "1.0.0-beta.4",
"#ngx-translate/core": "^8.0.0",
"angl-spawebbgrl": "^6.2.0",
"angular2-text-mask": "^8.0.4",
"angular2-tinymce": "2.1.2",
"angular2-ui-switch": "^1.2.0",
"bootstrap": "^3.3.7",
"core-js": "2.4.1",
"font-awesome": "^4.7.0",
"intl": "^1.2.5",
"jquery": "^3.4.1",
"moment": "^2.24.0",
"ng2-bs3-modal": "^0.10.4",
"ng2-translate": "^5.0.0",
"ngx-bootstrap": "1.9.3",
"ngx-toastr": "^6.5.0",
"puppeteer": "^2.0.0",
"rxjs": "6.5.3",
"rxjs-compat": "^6.0.0-rc.0",
"text-mask-addons": "^3.7.0",
"tslib": "^1.9.0",
"xlsx": "^0.12.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"#angular/cli": "^7.3.9",
"#angular/compiler-cli": "^7.2.15",
"#angular/language-service": "^7.2.15",
"#types/jasmine": "3.4.6",
"#types/jasminewd2": "2.0.8",
"#types/node": "8.10.59",
"bower-art-resolver": "^2.0.10",
"chai": "4.2.0",
"codelyzer": "3.0.1",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "^4.4.1",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-coverage": "^2.0.1",
"karma-coverage-istanbul-reporter": "2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"karma-junit-reporter": "2.0.1",
"karma-mocha": "^1.1.1",
"karma-sinon": "1.0.5",
"mocha": "^6.2.2",
"mocha-junit-reporter": "1.23.1",
"protractor": "^6.0.0",
"selenium-webdriver": "^3.6.0",
"sinon": "1.17.5",
"ts-node": "3.0.4",
"tslint": "5.3.2",
"typescript": "^3.1.1"
},
"optionalDependencies": {
}
}
Our karma configuration:
karma.conf.js
module.exports = function (config) {
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
config.set({
basePath: '',
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-coverage'),
require('karma-coverage-istanbul-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('#angular-devkit/build-angular/plugins/karma')
],
files:[
'src/test.ts'
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true,
dir: 'coverage',
'report-config': { html: { subdir: 'html'} }
},
reporters: ['progress', 'kjhtml', 'coverage'],
port: 9876,
logLevel: config.LOG_DEBUG,
autoWatch: false,
singleRun: true,
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-auto-detect'
]
}
}
});
};
This error occurs when jenkins try to exec the tests, but locally runs everything ok. This problem is specific of the pipeline that is running over a linux machine;
Has someone to help me to get '[launcher]: ChromeHeadless have not captured in 60000 ms, killing.' fixed?
Any advice will be welcome. Tkx!
Just checking, but are you sure a valid version of Chrome is installed on the pipelined machine, and that the path is set so the launcher can find it?
It sounds like the laucher is timing out just trying to fire up HC, and the most obvious issue whould be it not being able to find a version to run.
i discovered how to solve this issue.
The client has a proxy-blocker to manage the networking configurations. So i provided the proxy as server in the customLauncher flag and works perfectly, but only in the pipeline, locally the tests stopped. but it's just take off the proxy that runs locally.
Before: This way the tests runs locally, but do not works in the jenkins pipeline (npm run test)
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-auto-detect'
]
}
}
After: This way the tests runs in the pipeline, but do not works locally cuz i'm not under the client networking with access to the proxy provied
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-bypass-list=*',
'--proxy-server=http://proxy.your.company'
]
}
}
Related
My Angular 9 Universal app is running smoothly locally. But I can't run it with serverless-offline. I am getting this error:
{
currentRoute: "get - /",
error: "Serverless-offline: route not found.",
existingRoutes: [
"* - /production",
"* - /production/{proxy*}"
],
statusCode: 404
}
Here is my serverless.yml code, generated by #ng-toolkit/serverless:
# generated by #ng-toolkit/serverless
service: brmed
plugins:
- serverless-apigw-binary
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
memorySize: 192
timeout: 30
stage: production
region: us-east-2
package:
exclude:
- src/**
- node_modules/**
- firebug-lite/**
- e2e/**
- coverage/**
- '!node_modules/aws-serverless-express/**'
- '!node_modules/binary-case/**'
- '!node_modules/type-is/**'
- '!node_modules/media-typer/**'
- '!node_modules/mime-types/**'
- '!node_modules/mime-db/**'
custom:
apigwBinary:
types:
- '*/*'
serverless-offline:
httpPort: 8181
functions:
api:
handler: lambda.universal
events:
- http: ANY {proxy+}
- http: ANY /
Here is my package.json file:
{
"name": "brmed",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --build-optimizer --output-path=\"dist/BRMed/browser",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"dev:ssr": "ng run BRMed:serve-ssr",
"serve:ssr": "serverless offline start",
"build:ssr": "ng build --prod && ng run BRMed:server:production",
"prerender": "ng run BRMed:prerender",
"build:browser:prod": "ng build --prod",
"build:browser:serverless": "ng build --prod --base-href /production/",
"build:serverless": "npm run build:browser:serverless && npm run build:server:serverless",
"build:prod": "npm run build:browser:prod && npm run build:server:prod",
"build:prod:deploy": "npm run build:prod && npm run deploy",
"build:serverless:deploy": "npm run build:serverless && npm run deploy",
"deploy": "serverless deploy",
"terminate": "serverless remove",
"server": "node local.js",
"build:server:prod": "ng run BRMed:server && webpack --config webpack.server.config.js --progress --colors",
"build:server:serverless": "ng run BRMed:server:serverless && webpack --config webpack.server.config.js --progress --colors"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.7",
"#angular/animations": "^9.0.2",
"#angular/cdk": "^9.0.1",
"#angular/common": "^9.0.2",
"#angular/compiler": "^9.0.2",
"#angular/forms": "^9.0.2",
"#angular/localize": "^9.0.2",
"#angular/material": "^9.0.1",
"#angular/platform-browser": "^9.0.2",
"#angular/platform-browser-dynamic": "^9.0.2",
"#angular/router": "^9.0.2",
"#fortawesome/angular-fontawesome": "^0.6.0",
"#fortawesome/fontawesome-svg-core": "^1.2.27",
"#fortawesome/free-brands-svg-icons": "^5.12.1",
"#fortawesome/free-regular-svg-icons": "^5.12.1",
"#fortawesome/free-solid-svg-icons": "^5.12.1",
"#ng-bootstrap/ng-bootstrap": "^4.1.0",
"#ng-toolkit/serverless": "^8.0.3",
"#nguniversal/express-engine": "^9.0.1",
"#nguniversal/module-map-ngfactory-loader": "^8.2.6",
"#sentry/browser": "^5.12.4",
"#types/googlemaps": "^3.39.3",
"angular-gauge-chart": "^0.7.2",
"angular-google-charts": "^0.1.6",
"angular2-text-mask": "^9.0.0",
"aws-serverless-express": "^3.2.0",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"cors": "~2.8.4",
"cp-cli": "^1.1.0",
"express": "^4.15.2",
"hammerjs": "^2.0.8",
"intersection-observer": "^0.7.0",
"jquery": "^1.9.1",
"ng-intercom": "^8.0.2",
"ng-lazyload-image": "^6.1.0",
"ngx-device-detector": "^1.3.11",
"node-sass": "^4.13.0",
"popper.js": "^1.14.7",
"postcss": "^7.0.27",
"rxjs": "~6.5.4",
"serverless": "^1.64.1",
"serverless-http": "^2.3.2",
"tslib": "^1.11.0",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"ws": "^7.1.1",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.900.3",
"#angular/cli": "^9.0.3",
"#angular/compiler-cli": "^9.0.2",
"#angular/core": "^9.0.2",
"#angular/language-service": "^9.0.2",
"#angular/platform-server": "^9.0.0",
"#nguniversal/builders": "^9.0.1",
"#types/express": "^4.17.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^8.9.5",
"#types/stripe-v3": "^3.1.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"opencollective": "^1.0.3",
"protractor": "~5.4.0",
"serverless-apigw-binary": "^0.4.4",
"serverless-offline": "^6.0.0-alpha.67",
"ts-loader": "4.2.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^3.7.5"
}
}
I researched online a lot to find the solution for this problem, but without success. Maybe the standard procedures that worked with Angular 8, are not working with Angular 9.
Try updating your base-href, for example you can update your run script with:
ng build --prod --base-href /production/
or update it dynamically in your server.js/ts when serving the html, do something like
.....server html string generated....
html = html.replace('<base href="/', '<base href="/production/');
Anybody can help me?
How to build only one bundle.js with angular 8 ? Lots of javascript files were created when I executed "npm run build". (e.g main.js/runtime.js/polyfills.js/...)
I hope that all of them(main.js/runtime.js/polyfills.js/) can output to bundle.js
Here is my packages.json:
{
"name": "buy-me",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --aot --build-optimizer --base-href /buyme/ --deploy-url /buyme/",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular-devkit/core": "^8.0.1",
"#angular/animations": "^8.0.0",
"#angular/common": "^8.0.0",
"#angular/compiler": "^8.0.0",
"#angular/core": "^8.0.0",
"#angular/forms": "^8.0.0",
"#angular/platform-browser": "^8.0.0",
"#angular/platform-browser-dynamic": "^8.0.0",
"#angular/router": "^8.0.0",
"core-js": "^3.1.3",
"ngx-markdown": "^8.0.1",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.800.1",
"#angular/cli": "^8.0.1",
"#angular/compiler-cli": "^8.0.0",
"#angular/language-service": "^8.0.0",
"#types/jasmine": "~3.3.13",
"#types/jasminewd2": "~2.0.6",
"#types/node": "~12.0.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.2",
"ts-node": "~8.2.0",
"tslint": "~5.17.0",
"typescript": "^3.4.5"
}
}
I tried but output files like main.js, polyfills.js, runtime.js and so on, I hope that these can be concat one bundle.js.
With Angular 8 you don't have to bundle those files together. But if you want, the following steps will help you with that:
Install concat package into your project
Add the following lines to your package.json's "scripts" section:
"concat:es-5": "concat -o ./dist/ng-test-proj/bundle-es5.js ./dist/ng-test-proj/main-es5.*.js ./dist/ng-test-proj/polyfills-es5.*.js ./dist/ng-test-proj/runtime-es5.*.js",
"concat:es-2015": "concat -o ./dist/ng-test-proj/bundle-2015.js ./dist/ng-test-proj/main-es2015.*.js ./dist/ng-test-proj/polyfills-es2015.*.js ./dist/ng-test-proj/runtime-es2015.*.js",
"build:prod": "ng build -c production",
"build:prod:bundle": "npm run build:prod && npm run concat:es-5 && npm run concat:es-2015",
Now you can execute "npm run build:prod:bundle" in a terminal and you will get two bundle files.
As a last step, your HTML file should be updated (it should has links to those bundles if you want to use them instead of original files).
I have been researching on this issue but was not able to find any solution below is the error that i get while running the ng test build in Continues Integration build command prompt.
"message": "An error was thrown in afterAll\nUncaught [object Object] thrown",
"str": "An error was thrown in afterAll\nUncaught [object Object] thrown"
Below is my karma config.js:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: [
'jasmine', '#angular-devkit/build-angular'
],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('#angular-devkit/build-angular/plugins/karma'),
require('karma-trx-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: [
'html', 'lcovonly', 'cobertura'
],
fixWebpackSourcePaths: true
},
junitReporter: {
outputDir: require('path').join(__dirname, '../coverage'),
outputFile: 'cobertura-coverage.xml'
},
reporters: [
'progress', 'kjhtml', 'trx'
],
// the default configuration
trxReporter: {
outputFile: 'test-results.xml',
shortTestName: false
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
Below is my Package.json:
{
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test --code-coverage --watch=false --browsers=ChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e",
},
"private": true,
"dependencies": {
"#angular/animations": "^7.1.0",
"#angular/common": "^7.1.0",
"#angular/compiler": "^7.1.0",
"#angular/core": "^7.1.0",
"#angular/forms": "^7.1.0",
"#angular/http": "^7.1.0",
"#angular/platform-browser": "^7.1.0",
"#angular/platform-browser-dynamic": "^7.1.0",
"#angular/router": "^7.1.0",
"#ng-bootstrap/ng-bootstrap": "^4.0.1",
"#types/applicationinsights-js": "^1.0.7",
"applicationinsights-js": "^1.0.20",
"core-js": "^2.5.7",
"moment": "^2.22.2",
"moment-es6": "^1.0.0",
"oidc-client": "^1.5.4",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.13.1",
"#angular/cli": "^7.0.4",
"#angular/compiler-cli": "^7.1.0",
"#angular/language-service": "^7.1.0",
"#types/jasmine": "^3.3.0",
"#types/jasminewd2": "^2.0.6",
"#types/node": "^10.12.10",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-junit-reporter": "^1.2.0",
"karma-trx-reporter": "^0.4.0",
"protractor": "^5.4.1",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"tslint-consistent-codestyle": "^1.14.1",
"tslint-defocus": "^2.0.5",
"tslint-eslint-rules": "^5.4.0",
"tslint-origin-ordered-imports-rule": "^1.1.2",
"tslint-rxjs-subject-restrictions-rule": "^1.0.4",
"tslint-sonarts": "^1.8.0",
"typescript": "3.2.4",
"webpack-dev-server": "^3.1.10"
}
}
How to log the specific file name that is causing this issue as it is very difficult to debug looking at this error.
any suggestion is highly appreciated.
and also i am aware that in local i don't see any such errors while running "ng test"/"npm run package"(Headless chrome).But only i get to see this error in Continuous Integration build console command prompt.
I also faced a similar issue, which occurs intermittently when we run ng test locally, as well.
The question question helped in resolving this issue:
Karma Start Fails - HeadlessChrome - ERROR Uncaught [object Object]
package.json Angular6:
{
"name": "adnanrealestate",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.3",
"#angular-mdc/web": "^0.36.3",
"#angular/animation": "^4.0.0-beta.8",
"#angular/animations": "^6.0.7",
"#angular/cdk": "github:angular/cdk-builds",
"#angular/common": "^6.0.7",
"#angular/compiler": "^6.0.7",
"#angular/core": "^6.0.7",
"#angular/forms": "^6.0.7",
"#angular/http": "^6.0.7",
"#angular/material": "github:angular/material2-builds",
"#angular/platform-browser": "^6.0.7",
"#angular/platform-browser-dynamic": "^6.0.7",
"#angular/platform-server": "^6.1.7",
"#angular/router": "^6.0.7",
"#google-cloud/firestore": "^0.16.1",
"#ng-bootstrap/ng-bootstrap": "^2.1.2",
"#ng-bootstrap/schematics": "^2.0.0-alpha.1",
"#ngrx/store": "^2.2.3",
"#ngui/map": "^0.30.3",
"#ngx-translate/core": "^10.0.2",
"#ngx-translate/http-loader": "^3.0.1",
"#types/googlemaps": "^3.30.10",
"angular-captcha": "^3.4.0",
"angular-file-upload": "^2.5.0",
"angular-file-uploader": "^4.1.1",
"angular-font-awesome": "^3.1.2",
"angularfire2": "^5.0.0-rc.12-next",
"bootstrap": "^4.1.1",
"core-js": "^2.5.4",
"file-saver": "^1.3.8",
"filepond": "^1.8.6",
"firebase": "^5.2.0",
"firebase-admin": "^5.12.1",
"firebase-functions": "^1.1.0",
"firestore": "^1.1.6",
"font-awesome": "^4.7.0",
"fs": "0.0.1-security",
"hammerjs": "^2.0.8",
"json2typescript": "^1.0.6",
"linq2fire": "^1.0.18",
"ng-bootstrap-form-validation": "^3.0.3",
"ng-recaptcha": "^4.0.0",
"ng-slideshow": "^0.8.2",
"ngx-bootstrap": "^3.0.1",
"ngx-gallery": "^5.6.2",
"ngx-international-phone-number": "^0.1.3",
"ngx-intl-tel-input": "^1.0.6",
"ngx-order-pipe": "^2.0.1",
"ngx-pagination": "^3.2.0",
"ngx-popover": "0.0.16",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.1",
"time-ago-pipe": "^1.3.2",
"uikit": "^3.0.0-rc.6",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.8",
"#angular/cli": "^6.2.1",
"#angular/compiler-cli": "^6.0.7",
"#angular/language-service": "^6.0.7",
"#types/hammerjs": "^2.0.35",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "^5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
package.json firebase-functions
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
},
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "~2.8.3"
},
"private": true
}
\%RESOURCE_DIR%\ image
How can I fix this error?
and after a change to $ same error
I use npm install for angular 6 and for firebase functions, I didn't see any difference.
please help this is a bad error I don't know where is error specifically of version or other.
https://github.com/firebase/firebase-tools/issues/610
I solved this problem, It's very easy. You don't need to uninstall.
Step1: open firebase.json
you will show this JSON file
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
Step2: Delete "npm --prefix \"$RESOURCE_DIR\" run lint", and "npm --prefix \"$RESOURCE_DIR\" run build"
"functions": {
"predeploy": [
]
}
Step3: firebase deploy --only functions.
Step4: Like and share my solved.
I am trying to deploy a MEAN app to Heroku, but cannot push due to the following error:
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
I tried setting a node.js buildpack with their latest node buildpack release, but just received another error:
failed to detect buildpack
This is my first deployment to Heroku, so I'm brand new at this.
Here are my package.jsons:
Server
{
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"bcrypt": "^1.0.2",
"body-parser": "^1.16.1",
"cookie-parser": "^1.4.3",
"cors": "^2.8.2",
"debug": "^2.6.3",
"ejs": "~2.5.5",
"express": "^4.14.1",
"jsonwebtoken": "^7.3.0",
"mongoose": "^4.9.2",
"morgan": "^1.7.0",
"multer": "^1.3.0",
"passport": "^0.3.2",
"passport-jwt": "^2.2.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"serve-favicon": "^2.3.2"
}
}
Client
{
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "^2.4.0",
"#angular/compiler": "^2.4.0",
"#angular/core": "^2.4.0",
"#angular/forms": "^2.4.0",
"#angular/http": "^2.4.0",
"#angular/platform-browser": "^2.4.0",
"#angular/platform-browser-dynamic": "^2.4.0",
"#angular/router": "^3.4.0",
"#types/googlemaps": "^3.26.8",
"#types/jquery": "^2.0.43",
"#types/lodash": "^4.14.62",
"#types/underscore": "^1.8.0",
"amcharts3-angular2": "github:amcharts/amcharts3-angular2",
"angular2-google-maps": "^0.17.0",
"core-js": "^2.4.1",
"dotenv": "^4.0.0",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"ng2-google-charts": "^2.1.0",
"rxjs": "^5.1.0",
"tslint": "^4.4.2",
"typescript": "^2.0.10",
"underscore": "^1.8.3",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#angular/cli": "1.0.0-rc.0",
"#angular/compiler-cli": "^2.4.0",
"#types/jasmine": "2.5.38",
"#types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.0.0"
}
}
Why is Heroku not detecting Node?
According to the Heroku documentation
To determine how to start your app, Heroku first looks for a Procfile.
If no Procfile exists for a Node.js app, we will attempt to start a
default web process via the start script in your package.json.
So you shouldn't need to set the build pack.
I have two package.jsons, one for client and one for server. I needed to put my server dependencies into the root folder (they were each nested in client and server folders, respectively). Moving it into root made it detectable by heroku. Of course, now I have a new error. :)