I have react next and node js project and I want to deploy that project at heroku. That is the structure of my project:-
and my package.json file is if I add "Start": "next start" only the frontend works and if I changed it "Start": "tsc -p server/tsconfig.json -watch && node server.js" it's gave me the error.
CodePudding user response:
After Heroku installs the dependencies
and devDependencies
listed in package.json
, all devDependencies
get removed before the npm start
command is run. So if you installed typescript
under devDependencies
and your project needs it at runtime, it won't be found. To stop it from being pruned, move typescript
over to dependencies
instead.
Another option would be to skip the pruning process altogether by setting the following config vars:
$ heroku config:set NPM_CONFIG_PRODUCTION=false YARN_PRODUCTION=false
Or set the NODE_ENV
environment variable to anything other than production
(Heroku's default).