Я получаю сообщение об ошибке при выполнении командной строки ng build --prod
. Ошибка при развертывании в Heroku. локальный работает без проблем, я создаю каталог dist после ng build и копирую файлы вручную, используя copyfiles package .
Мой package.json:
{
"name": "admin-angular",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"start": "node ./dist/index.js",
"build": "ng build --prod",
"heroku-postbuild": "npm run html && ng build",
"html": "copyfiles -u 1 ./src/app/**/*.html ./src/app/**/*.css dist/"
},
"main": "dist/server.js",
"private": true,
"dependencies": {
"@angular-devkit/core": "^7.2.1",
"@angular/animations": "^5.0.2",
"@angular/cli": "^7.2.1",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.3",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@swimlane/ngx-datatable": "^11.1.2",
"angular-calendar": "^0.22.1",
"angular-linq": "^1.0.6",
"bootstrap": "^4.2.1",
"bootstrap-sass": "^3.3.7",
"core-js": "^2.4.1",
"d3-request": "^1.0.6",
"jquery": "^3.3.1",
"jquery-slimscroll": "^1.3.8",
"linq-es2015": "^2.4.32",
"ng2-dragula": "^1.5.0",
"ng2-file-upload": "^1.3.0",
"ng2-smart-table": "^1.2.2",
"ng2-toastr": "^4.1.2",
"ngx-papaparse": "^2.1.0",
"ngx-perfect-scrollbar": "^5.0.0",
"ngx-quill": "^2.0.4",
"ngx-responsive-stack-table": "^1.0.2",
"ngx-tags-input": "^1.1.1",
"node": "^12.4.0",
"node-sass": "^4.10.0",
"pace-js": "^1.0.2",
"popper.js": "^1.12.5",
"rxjs": "^5.5.0",
"tags-input": "^1.1.1",
"typescript": "~2.4.2",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.12.1",
"@angular/language-service": "^5.0.0",
"@ng-bootstrap/ng-bootstrap": "^1.1.2",
"@types/chartist": "^0.9.37",
"@types/jquery": "^3.2.5",
"@types/node": "^6.0.111",
"codelyzer": "~3.2.0",
"copyfiles": "^2.1.0",
"grunt-tsc": "^1.0.12",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0"
},
"engines": {
"node": ">=10.6.0 <11.0",
"npm": ">=6.1.0"
}
}
Ошибка, сгенерированная в Heroku:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): >=10.6.0 <11.0
engines.npm (package.json): >=6.1.0
Resolving node version >=10.6.0 <11.0...
Downloading and installing node 10.16.0...
Bootstrapping npm >=6.1.0 (replacing 6.9.0)...
npm >=6.1.0 installed
-----> Installing dependencies
Installing node modules (package.json + package-lock)
> node@12.4.0 preinstall /tmp/build_c51a0bc745677146e16e4ce85a198c53/node_modules/node
> node installArchSpecificPackage
+ node-linux-x64@12.4.0
added 1 package in 1.865s
found 0 vulnerabilities
> node-sass@4.12.0 install /tmp/build_c51a0bc745677146e16e4ce85a198c53/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.12.0/linux-x64-72_binding.node
Download complete
Binary saved to /tmp/build_c51a0bc745677146e16e4ce85a198c53/node_modules/node-sass/vendor/linux-x64-72/binding.node
Caching binary to /tmp/npmcache.XwMsb/node-sass/4.12.0/linux-x64-72_binding.node
> node-sass@4.12.0 postinstall /tmp/build_c51a0bc745677146e16e4ce85a198c53/node_modules/node-sass
> node scripts/build.js
Binary found at /tmp/build_c51a0bc745677146e16e4ce85a198c53/node_modules/node-sass/vendor/linux-x64-72/binding.node
Testing binary
Binary is fine
added 1134 packages from 800 contributors and audited 40331 packages in 128.527s
found 28 vulnerabilities (1 low, 5 moderate, 22 high)
run `npm audit fix` to fix them, or `npm audit` for details
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> admin-angular@0.0.0 heroku-postbuild /tmp/build_c51a0bc745677146e16e4ce85a198c53
> npm run html && ng build
> admin-angular@0.0.0 html /tmp/build_c51a0bc745677146e16e4ce85a198c53
> copyfiles -u 1 ./src/app/**/*.html ./src/app/**/*.css dist/
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
Date: 2019-06-22T11:35:36.930Z
Hash: 6b6530730d13c909797a
ERROR in src/app/cv/educacio/idiomes/idiomes.component.ts(2,25): error TS2307: Cannot find module './Idiomes.model'.
Time: 9354ms
chunk {main} main.js, main.js.map (main) 634 bytes [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.4 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 806 kB [initial] [rendered]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admin-angular@0.0.0 heroku-postbuild: `npm run html && ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the admin-angular@0.0.0 heroku-postbuild 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! /tmp/npmcache.XwMsb/_logs/2019-06-22T11_35_36_956Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Может ты мне поможешь, пожалуйста?