Can't build Angular project after upgrade from 8 to 9 - node.js

I've done an upgrade of my Angular project from 8 to 9 by using the ng update tool. Locally (Windows) everything works fine, but when I'm trying to build the project in docker, I get the following error:
Step 6/11 : RUN npm run build
---> Running in d60f739a56f6
> check-it-frontend#0.0.0 build /app
> ng build --prod
Compiling #angular/core : es2015 as esm2015
ERROR in EINVAL: invalid argument, rename '/app/node_modules/#angular/core/core.d.ts' -> '/app/node_modules/#angular/core/core.d.ts.__ivy_ngcc_bak'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! check-it-frontend#0.0.0 build: `ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the check-it-frontend#0.0.0 build 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! /root/.npm/_logs/2020-03-20T11_44_02_696Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
The dockerfile:
FROM node:13.10.1-stretch as base
RUN apt-get update -qq && apt-get install -y build-essential
ADD . /app
WORKDIR /app
RUN npm ci
RUN npm run build
Dependencies:
"dependencies": {
"#angular/animations": "^9.0.7",
"#angular/cdk": "^8.2.3",
"#angular/common": "^9.0.7",
"#angular/compiler": "^9.0.7",
"#angular/core": "^9.0.7",
"#angular/forms": "^9.0.7",
"#angular/material": "^8.2.3",
"#angular/platform-browser": "^9.0.7",
"#angular/platform-browser-dynamic": "^9.0.7",
"#angular/router": "^9.0.7",
"core-js": "^2.4.1",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.0.0-rc.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.900.7",
"#angular/cli": "^9.0.7",
"#angular/compiler-cli": "^9.0.7",
"#angular/language-service": "^9.0.7",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"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",
"node-sass": "^4.13.1",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~3.7.5"
}
Anything I can do to fix it? Images for Angular 8 were fine. I've tried different node images, but nothing helped...

I'm not exactly sure what your issue is or what's causing it, but I did a quick search and stumbled upon this github issue. It concerns parallel builds (which I don't think is your case), but I thought it could still apply here since the error happens during the compilation of angular core.
The suggested workaround is to run the angular compatibility compiler (ngcc) as a postinstall script, instead of having the build trigger it itself.
Modify your package.json file and add the following to the scripts section:
"postinstall": "ngcc

Related

how to fix npm ERR! code ELIFECYCLE (heroku)

I'm currently working on a project since i've been teaching myself Angular over the past couple weeks. I wrote up my code, created what I thought I needed for deploying on heroku and tried to deploy it. I received the following error
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> purposefularmament#0.0.0 heroku-postbuild /tmp/build_2c8456a0
> ng build --configuration production
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! purposefularmament#0.0.0 heroku-postbuild: `ng build --configuration
production`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the purposefularmament#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.JjS0Q/_logs/2022-09-23T14_54_55_966Z-debug.log
-----> Build failed
after doing some research I only found that this error is caused by an issue with my npm install. I deleted my node_modules file and removed package-lock.json, cleared the npm cache and then reinstalled npm. I repushed the code and Im still getting this same error.
Any suggestions?
Here is my package.json and server.js files
{
"name": "purposefularmament",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-postbuild": "ng build --configuration production"
},
"private": true,
"dependencies": {
"#angular/animations": "~11.1.2",
"#angular/cli": "^14.2.3",
"#angular/common": "~11.1.2",
"#angular/compiler": "~11.1.2",
"#angular/compiler-cli": "^11.2.14",
"#angular/core": "~11.1.2",
"#angular/forms": "~11.1.2",
"#angular/platform-browser": "~11.1.2",
"#angular/platform-browser-dynamic": "~11.1.2",
"#angular/router": "~11.1.2",
"bootstrap": "^5.2.1",
"bootstrap-icons": "^1.9.1",
"bulma": "^0.9.4",
"express": "^4.18.1",
"grunt-express": "^1.4.1",
"node": "^14.15.0",
"path": "^0.12.7",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"typescript": "~4.1.2",
"zone.js": "~0.11.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.1101.4",
"#angular/cli": "^14.2.3",
"#angular/compiler-cli": "^11.2.14",
"#types/jasmine": "~3.6.0",
"#types/node": "^12.11.1",
"autoprefixer": "^10.4.8",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.2.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"postcss": "^8.4.16",
"protractor": "~7.0.0",
"tailwindcss": "^3.1.8",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
},
"engines": {
"node": "14.15.0",
"npm": "6.14.13"
}
}
and server.js
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/purposefularmament'));
app.get('/*', function(req,res) {
res.sendFile('index.html', {root: 'dist/purposefularmament/'});
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
Welp I spoke too soon, for those of you how care I fixed the issue by updating node.js to the newest latest version. I was lead to believe that both heroku and my local system should use the same node version. For whatever reason my version was behind. After adjusting for the new node version I repushed and everything worked.

Could not resolve peer dependency between my Angular app and my custom Angular library

I have created this Angular library that I now want to use in my other Angular apps, but I seem to have trouble with my peer dependencies. I have tried fiddling around in my App's package.json, but couldn't seem to remove any of my errors.
What I have tried (in that order) :
Removing node_modules
ng update
npm update
npm audit --fix
npm i
Recreating a new test app all together
Here are the errors :
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: lib-test#0.0.0
npm ERR! Found: #angular/common#13.0.3
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"~13.0.0" from the root project
npm ERR! peer #angular/common#"^13.0.0 || ^14.0.0-0" from #angular/cdk#13.2.2
npm ERR! node_modules/#angular/cdk
npm ERR! #angular/cdk#"^13.2.0" from the root project
npm ERR! peer #angular/cdk#"^13.0.0" from #my-group/angular-lib#1.1.4
npm ERR! node_modules/#my-group/angular-lib
npm ERR! #my-group/angular-lib#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/common#"^13.1.0" from #my-group/angular-lib#1.1.4
npm ERR! node_modules/#my-group/angular-lib
npm ERR! #my-group/angular-lib#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
package.json (App)
{
"name": "lib-test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"#angular/animations": "~13.0.0",
"#angular/cdk": "^13.2.2",
"#angular/common": "~13.0.0",
"#angular/compiler": "~13.0.0",
"#angular/core": "~13.0.0",
"#angular/forms": "~13.0.0",
"#angular/material": "^13.2.2",
"#angular/platform-browser": "~13.0.0",
"#angular/platform-browser-dynamic": "~13.0.0",
"#angular/router": "~13.0.0",
"#cloud-republic/angular-lib": "^1.1.4",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "~13.0.3",
"#angular/cli": "~13.0.3",
"#angular/compiler-cli": "~13.0.0",
"#types/jasmine": "~3.10.0",
"#types/node": "^12.11.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3"
}
}
package.json (Library)
{
"name": "#my-group/angular-lib",
"version": "1.0.6",
"publishConfig": {
"#my-group:registry": "https://gitlab.com/api/v4/projects/XXXXXX/packages/npm/"
},
"scripts": {
"build-lib": "ng build lib-angular",
"semantic-release": "semantic-release"
},
"peerDependencies": {
"#angular/cdk": "^13.0.0",
"#angular/common": "^13.1.0",
"#angular/core": "^13.1.0",
"#angular/material": "^13.2.0",
"ngx-bootstrap": "^8.0.0",
"rxjs": "~7.4.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"devDependencies": {
"#semantic-release/gitlab": "^7.0.4",
"semantic-release": "^19.0.2"
}
}
Thanks in advance
This is not the issue with peer dependencies. This is more to do with version conflict. I guess you are using npm >=7 that's why you are getting this error:-
As mentioned in the error log try the below command to fix the issue:-
npm install --legacy-peer-deps
The above solution will solve your problem. However, the main issue is with your library.
In your library package you are saying use the below package:-
"#angular/common": "^13.1.0"
However, in your application, you have installed the below version.
"#angular/common": "~13.0.0".
So your library package is greater than the one installed in the application.
Either install the same version in your application or downgrade the version in your library.
In this way, npm install command will work without any issue.

Same exact package.json file works in empty brand new project but doesn't in old project

I get this error when I try to upgrade to Angular 8.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an
old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from
the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: comprehensivedashboard#0.0.0
npm ERR! Found: #angular/animations#7.2.6
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~8.2.14" from the root project
npm ERR! peer #angular/animations#">=7.0.0" from
#angular/material#7.3.3
npm ERR! node_modules/#angular/material
npm ERR! #angular/material#"~8.2.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! #angular/animations#"~8.2.14" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/core#8.2.14
npm ERR! node_modules/#angular/core
npm ERR! peer #angular/core#"8.2.14" from #angular/animations#8.2.14
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~8.2.14" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency
resolution.
npm ERR!
npm ERR! See
C:\Users\vakkinen\AppData\Local\npm-cache\eresolve-report.txt for a
full report.
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\vakkinen\AppData\Local\npm-cache_logs\2021-10-05T12_19_50_257Z-debug.log
So decided to create a brand new Angular8 app and see what the package.json file looks like. That file is attached below. Then I added all the packages I need to this brand new empty project one at a time. The application build succeeded and I was able to run the application. So I copied and pasted all the dependencies and devDependencies to the old project package.json. That project still fails npm i because of the same error above. So I tried to clone the repo into a new directory and replaced the contents of the package.json with the contents of the package.json from the brand new empty project, still the same error. What am I doing wrong ?
{
"name": "dashboard",
"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": {
"#angular/animations": "~8.2.14",
"#angular/cdk": "8.2.3",
"#angular/common": "~8.2.14",
"#angular/compiler": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/forms": "~8.2.14",
"#angular/material": "~8.2.3",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"#ng-bootstrap/ng-bootstrap": "^5.3.0",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"#swimlane/ngx-charts": "^11.0.0",
"fusioncharts": "^3.15.0-sr.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ngx-bootstrap": "^3.2.0",
"ngx-csv": "^0.3.1",
"ngx-export-as": "1.4.2",
"ngx-scrollbar": "^4.1.1",
"ngx-select-dropdown": "^1.0.1",
"node-sass": "^4.14.0",
"rxjs": "~6.4.0",
"sass-loader": "^8.0.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.13.0",
"#angular/cli": "~8.3.29",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
There should be a file called package-lock in the same folder as the package file. Delete it and the error should go away. The package-lock file contains all dependencies of your dependencies and their versions. Deleting it doesn’t affect your project since it’s regenerated on npm install.
The error message warns you that the package-lock.json file is the issue. Just delete it and a new one will be generated.
The issue stems from having incorrect files in the node_modules directory and the package-lock.json.
Most probably the easiest solution is to delete both the node_modules directory and the package-lock.json and then running a npm install to get a clean node_modules directory and a new package-lock.json according to your package.json
I recommend reading more about what the package-lock.json file is for here: https://medium.com/coinmonks/everything-you-wanted-to-know-about-package-lock-json-b81911aa8ab8
Steps to fix this issue:
Delete node_modules folder.
Delete package-lock.json.
Run npm i --force.

Npm install error EPERM Operation not permitted

So when trying to run the angular4 project today my first error was : npm install eperm operation not permitted so I thought to delete my node modules folder and retry. But running npm install I am running in to this error npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start". I've closed vscode to try and run the install to make sure nothing was locking it. I've tried npm cache clean but results in errors.
Todays latest struggles :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli '#angular/cli#latest' ]
2 info using npm#5.5.1
3 info using node#v8.9.3
4 verbose npm-session 2a0bb102467943cf
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 error cb() never called!
Admin Results:
Any suggestions?
My package.json looks like this :
{
"name": "gamemanagement",
"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/animations": "^5.0.1",
"#angular/cdk": "^5.0.0-rc0",
"#angular/common": "^5.0.1",
"#angular/compiler": "^5.0.1",
"#angular/compiler-cli": "^5.0.1",
"#angular/core": "^5.0.1",
"#angular/forms": "^5.0.1",
"#angular/http": "^5.0.1",
"#angular/material": "^5.0.0-rc0",
"#angular/platform-browser": "^5.0.1",
"#angular/platform-browser-dynamic": "^5.0.1",
"#angular/platform-server": "^5.0.1",
"#angular/router": "^5.0.1",
"#ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"angular2-moment": "^1.7.0",
"angular2-text-mask": "^8.0.4",
"angularfire2": "5.0.0-rc.3",
"ap-angular2-fullcalendar": "^1.3.5",
"bootstrap": "4.0.0-beta",
"core-js": "^2.4.1",
"firebase": "4.6.2",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"moment": "^2.19.3",
"ng2-date-picker": "^2.6.2",
"popper.js": "^1.12.9",
"rxjs": "^5.4.2",
"sweetalert2": "^7.0.9",
"typescript": "^2.6.1",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.5.3",
"#angular/compiler-cli": "^4.2.4",
"#angular/language-service": "^4.2.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"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": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}
I had the same issue. After cache clean and updating npm everything is ok. So try to run:
npm cache clean --force
npm install -g npm#latest
There are 2 solutions for this
you can run "npm cache clean"
you run the command prompt in admin mode.
macOS catalina ,
npm init
got error
operation not permitted, uv_cwd
step 1: go to parent folder
cd ../
step 2: go to your project folder again,
cd your-project-folder
That is it. it works.
Try below setps, hope this helps.
Update Node.js
npm cache clean command in Command prompt, try as admin
check node proxy settings if persist remove them with below
npm config delete http-proxy
npm config delete https-proxy
Install by yourself the module that is giving the error.
After spending many hours and trying all the possible suggestions, I found that installing the specific module mentioned by the error globally fixed the issue:
For Example:
npm ERR! { Error: EPERM: operation not permitted, unlink 'Path\Docume
nts\AngularProjects\my-sample-app333\node_modules.staging#angular\core-a3d1aa4
8\ bundles\core.umd.js
I run: npm install -global #angular/core
and it fixed it for me! Finally!!
Just try npm cache clean quick and simple :)
I tried everything above but it did not work for me.
I copied all content of package.json and deleted the file. Then, I created a new file and copied all there and I saved it as package.json
That fixed everything
100% sure
Firstly delete the project folder. eg: myapp1
Then run ->npm cache clean --force command
Retype the command that gives error previously.
I also faced the same issue but once I removed node_modules folder along with package-lock.json from the project and then I re-installed entire thing again with npm i it worked for me.

Failed to compile Node.js app to heroku

Hello.
I have an wierd error. I recently reinstalled everything on my laptop. Now i ran into troubles. Everytime i use this config from package.json i get error pushing to heroku.
{
"name": "mrfrederiksen",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"postinstall": "ng build --aot -prod",
"start": "node server.js"
},
"engines": {
"node": "7.7.3",
"npm": "4.1.2"
},
"private": true,
"dependencies": {
"#angular/cli": "1.0.0",
"#angular/common": "^4.0.0",
"#angular/compiler": "^4.0.0",
"#angular/core": "^4.0.0",
"#angular/forms": "^4.0.0",
"#angular/http": "^4.0.0",
"#angular/platform-browser": "^4.0.0",
"#angular/platform-browser-dynamic": "^4.0.0",
"#angular/router": "^4.0.0",
"core-js": "^2.4.1",
"express": "^4.15.2",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#angular/compiler-cli": "^4.0.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.5.0",
"typescript": "~2.2.0"
}
}
But...
If i use this giving from an friend who have older versions installed everything works.
{
"name": "mrfrederiksen",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"postinstall": "ng build --aot -prod",
"start": "node server.js"
},
"engines": {
"node": "6.9.4",
"npm": "3.10.10"
},
"private": true,
"dependencies": {
"#angular/cli": "1.0.0-rc.0",
"#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",
"core-js": "^2.4.1",
"express": "^4.15.2",
"rxjs": "^5.1.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"#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"
}
}
Here is my error console messages when using my own with latest versions.
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 7.7.3
engines.npm (package.json): 4.1.2
Downloading and installing node 7.7.3...
npm 4.1.2 already installed with node
-----> Restoring cache
Skipping cache restore (new runtime signature)
-----> Building dependencies
Installing node modules (package.json)
> node-sass#4.5.1 install /tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.1/linux-x64-51_binding.node
Download complete
Binary saved to /tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/node-sass/vendor/linux-x64-51/binding.node
Caching binary to /app/.npm/node-sass/4.5.1/linux-x64-51_binding.node
> node-sass#4.5.1 postinstall /tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/node-sass
> node scripts/build.js
Binary found at /tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/node-sass/vendor/linux-x64-51/binding.node
Testing binary
Binary is fine
> mrfrederiksen#0.0.0 postinstall /tmp/build_5a8b797790355e544758529cdf0f5b1a
> ng build --aot -prod
The "#angular/compiler-cli" package was not properly installed.
Error: The "#angular/compiler-cli" package was not properly installed.
at Object.<anonymous> (/tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/#ngtools/webpack/src/index.js:14:11)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/build_5a8b797790355e544758529cdf0f5b1a/node_modules/#angular/cli/tasks/eject.js:10:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
npm ERR! Linux 3.13.0-112-generic
npm ERR! argv "/tmp/build_5a8b797790355e544758529cdf0f5b1a/.heroku/node/bin/node" "/tmp/build_5a8b797790355e544758529cdf0f5b1a/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_5a8b797790355e544758529cdf0f5b1a/.npmrc"
npm ERR! node v7.7.3
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! mrfrederiksen#0.0.0 postinstall: `ng build --aot -prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mrfrederiksen#0.0.0 postinstall script 'ng build --aot -prod'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mrfrederiksen package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng build --aot -prod
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mrfrederiksen
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mrfrederiksen
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_5a8b797790355e544758529cdf0f5b1a/npm-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
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
After I upgraded the npm, node, typescript and ng-cli to its latest versions, I had a similar kind of issue.
Tried many things but nothing worked out.
(ended up with "The "#angular/compiler-cli" package was not properly installed" error).
Then did the following steps:
Create a new project (ng new [project_name]) with new versions
Start the above created project with no code written using 'npm start' successfully
Copied the old projects 'src' folder into the new project folder
Copied folders (bootstrap) in old project in the new project folder
Start the project using 'npm start'
Everything started to work as usual.
Just update typescript v2.2.1 and it works

Resources