Error al comstackr la aplicación Node.js para heroku

Hola. Tengo un error extraño. Recientemente reinstalé todo en mi computadora portátil. Ahora me encontré con problemas. Cada vez que uso esta configuration desde package.json obtengo un error presionando a heroku.

{ "name": "mrfnetworkingeriksen", "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" } } 

Pero … Si uso esta donación de un amigo que tiene versiones anteriores instaladas, todo funciona.

 { "name": "mrfnetworkingeriksen", "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" } } 

Aquí está mi post de error de la console cuando uso el mío con las últimas versiones.

 -----> 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 restre (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 > mrfnetworkingeriksen@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! mrfnetworkingeriksen@0.0.0 postinstall: `ng build --aot -prod` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the mrfnetworkingeriksen@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 mrfnetworkingeriksen 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 mrfnetworkingeriksen npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls mrfnetworkingeriksen 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 

Después de actualizar las npm, node, typescript y ng-cli a sus últimas versiones, tuve un problema similar. Intenté muchas cosas pero nada funcionó.

 (ended up with "The "@angular/compiler-cli" package was not properly installed" error). 

Luego hizo los siguientes pasos:

  1. Crea un nuevo proyecto (ng new [project_name]) con nuevas versiones
  2. Comience el proyecto creado anteriormente sin código escrito usando 'npm start' con éxito
  3. Copió la carpeta 'src' de los proyectos antiguos en la carpeta del nuevo proyecto
  4. Carpetas copydas (bootstrap) en el proyecto anterior en la nueva carpeta del proyecto
  5. Comience el proyecto usando 'npm start'

Todo comenzó a funcionar como de costumbre.

Simplemente actualice el typescript v2.2.1 y funciona