Мое приложение работает нормально при локальном размещении, но при попытке развернуть сборку не удается со следующим выходным журналом:
-----> 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): 8.10.0
engines.npm (package.json): 6.4.1
Resolving node version 8.10.0...
Downloading and installing node 8.10.0...
Bootstrapping npm 6.4.1 (replacing 5.6.0)...
npm 6.4.1 installed
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Building dependencies
Installing node modules (package.json + package-lock)
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #5: Expected object but got string
npm ERR! typeerror at inflatableChild (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:93:3)
npm ERR! typeerror at BB.each (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:55:12)
npm ERR! typeerror at tryCatcher (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm ERR! typeerror at Object.gotValue (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:155:18)
npm ERR! typeerror at Object.gotAccum (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:144:25)
npm ERR! typeerror at Object.tryCatcher (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm ERR! typeerror at Promise._settlePromiseFromHandler (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
npm ERR! typeerror at Promise._settlePromise (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
npm ERR! typeerror at Promise._settlePromise0 (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
npm ERR! typeerror at Promise._settlePromises (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
npm ERR! typeerror at Async._drainQueue (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
npm ERR! typeerror at Async._drainQueues (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
npm ERR! typeerror at Immediate.Async.drainQueues (/tmp/build_8521c67f1a08023343c4f34aedc664fb/.heroku/node/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
npm ERR! typeerror at runCallback (timers.js:794:20)
npm ERR! typeerror at tryOnImmediate (timers.js:752:5)
npm ERR! typeerror at processImmediate [as _immediateCallback] (timers.js:729:5)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.Mus2Z/_logs/2018-11-18T01_38_26_671Z-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
Вот мой файл package.json:
{
"name": "scheduling",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"postinstall": "ng build --aot --target=production"
},
"engines": {
"node": "8.10.0",
"npm" : "6.4.1"
},
"repository": {
"type": "git",
"url": "https://github.com/ActionPackedJack/Restaurant-Schedule"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@angular/cli": ">=1.0.3",
"@angular/compiler-cli": ">=4.0.0",
"express": "^4.16.3",
"jquery": "^3.3.1",
"mongoose": "^5.2.2",
"rxjs": "^6.2.1",
"rxjs-compat": "^6.2.1",
"typescript": ">=2.2.0"
}
}
А вот и мой server.js:
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.set('port', (process.env.PORT || 5000));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended : true}))
var path = require('path');
app.use(express.static(path.join(__dirname, './public/dist/public/')));
app.get('/*', function(req,res){
res.sendFile(path.join(__dirname, '/public/dist'));
})
//app.set('views', path.join(__dirname, '/public/dist'))
require('./server/config/mongoose.js');
var routes_setter = require('./server/config/routes.js');
routes_setter(app);
app.listen(app.get('port'), function(){
console.log('Node app is running on port', app.get('port'))
});
Я прочитал другой случай, когда пользователь решил эту проблему, удалив его файл package-lock.json, но попытался, что привело к другой ошибке: «Команда сборки должна быть запущена в проекте Angular, но определение проекта может не найден. "
Любые мысли будут с благодарностью, пожалуйста, и спасибо!