Dependency error in Heroku
Opened this issue · 1 comments
christopheragnus commented
Hey, is anyone getting the following error?
I'm using GMaps in a Ruby On Rails project and deploying it to Heroku. GMaps works locally but fails to deploy - is there a way I can fix this? It looks like googlemaps
is not defined in the module?
Compiling...
Compilation failed:
ModuleNotFoundError: Module not found: Error: Can't resolve 'googlemaps' in '/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/gmaps'
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/lib/Compilation.js:925:10
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/lib/NormalModuleFactory.js:401:22
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/lib/NormalModuleFactory.js:130:21
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/lib/NormalModuleFactory.js:224:22
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/neo-async/async.js:2830:7
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/neo-async/async.js:6877:13
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/neo-async/async.js:2830:7
at done (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/neo-async/async.js:2925:13)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/lib/NormalModuleFactory.js:445:10
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
resolve 'googlemaps' in '/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/gmaps'
Parsed request is a module
using description file: /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/gmaps/package.json (relative path: .)
resolve as module
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/gmaps/node_modules doesn't exist or is not a directory
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/node_modules doesn't exist or is not a directory
/tmp/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules
using description file: /tmp/build_dd049e3191962ef42551e9d499b1f96e/package.json (relative path: ./node_modules)
using description file: /tmp/build_dd049e3191962ef42551e9d499b1f96e/package.json (relative path: ./node_modules/googlemaps)
no extension
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/googlemaps doesn't exist
.js
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/googlemaps.js doesn't exist
.json
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/googlemaps.json doesn't exist
as directory
/tmp/build_dd049e3191962ef42551e9d499b1f96e/node_modules/googlemaps doesn't exist
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed
hpneo commented
Hi @christopheragnus, I think Rails is trying to load the alias defined here. I didn't try to load gmaps with Webpack, so I can't help you, unless you can give me more info (how you load it, for example).
For now, I would recommend you to load the library externally, using UNPKG or other CDN.