1

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

2 Answers2

0

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:

  1. Create a new project (ng new [project_name]) with new versions
  2. Start the above created project with no code written using 'npm start' successfully
  3. Copied the old projects 'src' folder into the new project folder
  4. Copied folders (bootstrap) in old project in the new project folder
  5. Start the project using 'npm start'

Everything started to work as usual.

0

Just update typescript v2.2.1 and it works

elingerojo
  • 354
  • 2
  • 6