So i got a problem.
I try to deploy my MERN application to Heroku.
So when i do git push heroku master it runs okay but then it runs in a loop cd client && npm run build.
I have no idea why.
Does anyone of you know?
Here is my node:
const PORT = process.env.PORT || 8080;
mongoose.connect('my mongo db', {useNewUrlParser: true})
app.use(passport.initialize());
app.use(passport.session());
app.use(session({
resave: false,
saveUninitialized: false,
secret: 'secret here',
store: new MongoStore({ mongooseConnection: mongoose.connection })
}))
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use('/', indexRouter);
app.use('/authentication', usersRouter);
if (process.env.NODE_ENV === 'production') {
app.use(express.static('client/build'))
}
app.listen(PORT);
module.exports = app
And here is my package:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon app.js",
"build": "cd client && npm run build",
"install-client": "cd client && npm install",
"heroku-postbuild": "npm run install-client && npm run build"
},
I only posted the code require and not my whole code if something you need is missing let me know!
-Thanks