Getting error while deploying code in Heroku using TS

Viewed 18

We are using Ts files and by using webpack we're compiling all modules together as a bundle.js.So, now while deploying in Heroku it is showing me :

-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  18.7.0
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 18.7.0...
       Downloading and installing node 18.7.0...
       Using default npm version: 8.15.0
       
-----> Installing dependencies
       Installing node modules
       
       > babylon@1.0.0 postinstall
       > webpack --mode production
       
       assets by status 9.84 MiB [cached] 1 asset
       orphan modules 7.8 MiB [orphan] 1005 modules
       runtime modules 891 bytes 4 modules
       cacheable modules 21 MiB
         modules by path ./node_modules/@babylonjs/core/ 10.2 MiB 327 modules
         modules by path ./src/ 55.9 KiB
           modules by path ./src/Entities/*.ts 16.5 KiB 7 modules
           modules by path ./src/Player/*.ts 25.7 KiB 7 modules
           modules by path ./src/*.ts 1.96 KiB 2 modules
           ./src/GUI/MultiSceneGUI.ts 8.8 KiB [built] [code generated]
           ./src/Networking/Rooms/GameRoom.ts 2.88 KiB [built] [code generated] [3 errors]
         + 8 modules
       
       ERROR in ./src/Player/Player.ts 15:23-55
       Module not found: Error: Can't resolve './camera/PlayerCamera' in '/tmp/build_e2f9ba00/src/Player'
        @ ./src/Entities/CastleScene.ts 23:17-44
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Entities/CastleScene.ts
       ./src/Entities/CastleScene.ts 17:29-64
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Entities/CastleScene.ts(17,30)
             TS2307: Cannot find module '../networking/schema/PlayerSchema' or its corresponding type declarations.
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Entities/GardenScene.ts
       ./src/Entities/GardenScene.ts 17:29-64
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Entities/GardenScene.ts(17,30)
             TS2307: Cannot find module '../networking/schema/PlayerSchema' or its corresponding type declarations.
        @ ./src/app.ts 6:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts
       ./src/Networking/Rooms/GameRoom.ts 2:19-40
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts(2,20)
             TS2307: Cannot find module '../../player/Player' or its corresponding type declarations.
        @ ./src/Entities/CastleScene.ts 26:19-58
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts
       ./src/Networking/Rooms/GameRoom.ts 3:35-65
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts(3,36)
             TS2307: Cannot find module '../schema/StateHandlerSchema' or its corresponding type declarations.
        @ ./src/Entities/CastleScene.ts 26:19-58
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts
       ./src/Networking/Rooms/GameRoom.ts 4:29-53
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Networking/Rooms/GameRoom.ts(4,30)
             TS2307: Cannot find module '../schema/PlayerSchema' or its corresponding type declarations.
        @ ./src/Entities/CastleScene.ts 26:19-58
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Networking/Schema/StateHandlerSchema.ts
       9:7-23
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Networking/Schema/StateHandlerSchema.ts(9,8)
             TS2307: Cannot find module './playerSchema' or its corresponding type declarations.
       
       ERROR in /tmp/build_e2f9ba00/src/Player/OtherPlayer.ts
       ./src/Player/OtherPlayer.ts 3:29-64
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Player/OtherPlayer.ts(3,30)
             TS2307: Cannot find module '../networking/schema/PlayerSchema' or its corresponding type declarations.
        @ ./src/Entities/CastleScene.ts 24:22-54
        @ ./src/app.ts 5:22-55
       
       ERROR in /tmp/build_e2f9ba00/src/Player/Player.ts
       ./src/Player/Player.ts 5:25-48
       [tsl] ERROR in /tmp/build_e2f9ba00/src/Player/Player.ts(5,26)
             TS2307: Cannot find module './camera/PlayerCamera' or its corresponding type declarations.
        @ ./src/Entities/CastleScene.ts 23:17-44
        @ ./src/app.ts 5:22-55
       
       9 errors have detailed information that is not shown.
       Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
       
       webpack 5.74.0 compiled with 9 errors in 84836 ms
       npm ERR! code 1
       npm ERR! path /tmp/build_e2f9ba00
       npm ERR! command failed
       npm ERR! command sh /tmp/postinstall-63c20ff6.sh
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.8p80l/_logs/2022-09-21T08_09_10_193Z-debug-0.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - A module may be missing from 'dependencies' in package.json
         https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Did anyone know what is the main cause of this and how can i resolve this? I'm directly using the post-install command where

webpack --mode production

is used. Mean to say on the Heroku side we're using webpack to make a bundle and then run the server.

0 Answers
Related