Administrate: ModuleNotFoundError: Module not found: Error: Can't resolve '../components/table'

Created on 22 Mar 2020  路  6Comments  路  Source: thoughtbot/administrate

Hello everyone!

I am trying to push my app on Heroku but I get this error all the time: ModuleNotFoundError: Module not found: Error: Can't resolve '../components/table'. I followed this tutorial Rails 6 & Webpacker but I do not understand what I did wrong.

Here is the full trace:

remote:        Compiling...
remote:        Compilation failed:
remote:        ModuleNotFoundError: Module not found: Error: Can't resolve '../components/table' in '/tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/administrate'
remote:            at factory.create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/webpack/lib/Compilation.js:925:10)
remote:            at factory (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
remote:            at resolver (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
remote:            at asyncLib.parallel (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
remote:            at /tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/neo-async/async.js:2830:7
remote:            at /tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/neo-async/async.js:6877:13
remote:            at normalResolver.resolve (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
remote:            at doResolve (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:213:14)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at resolver.doResolve (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote:            at resolver.doResolve (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn42 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote:            at resolver.doResolve (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn1 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote:            at hook.callAsync (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at fs.stat (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:27:15)
remote:            at process.nextTick (/tmp/build_bc581682a35605f63eb0c25106eaaa0b/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15)
remote:            at process._tickCallback (internal/process/next_tick.js:61:11)
remote:        resolve '../components/table' in '/tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/administrate'
remote:          using description file: /tmp/build_bc581682a35605f63eb0c25106eaaa0b/package.json (relative path: ./app/javascript/administrate)
remote:            Field 'browser' doesn't contain a valid alias configuration
remote:            using description file: /tmp/build_bc581682a35605f63eb0c25106eaaa0b/package.json (relative path: ./app/javascript/components/table)
remote:              no extension
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table doesn't exist
remote:              .mjs
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.mjs doesn't exist
remote:              .js
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.js doesn't exist
remote:              .sass
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.sass doesn't exist
remote:              .scss
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.scss doesn't exist
remote:              .css
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.css doesn't exist
remote:              .module.sass
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.module.sass doesn't exist
remote:              .module.scss
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.module.scss doesn't exist
remote:              .module.css
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.module.css doesn't exist
remote:              .png
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.png doesn't exist
remote:              .svg
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.svg doesn't exist
remote:              .gif
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.gif doesn't exist
remote:              .jpeg
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.jpeg doesn't exist
remote:              .jpg
remote:                Field 'browser' doesn't contain a valid alias configuration
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table.jpg doesn't exist
remote:              as directory
remote:                /tmp/build_bc581682a35605f63eb0c25106eaaa0b/app/javascript/components/table doesn't exist
remote:
remote:
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed

The full path to table.js is app\javascript\components\table.js.

I am pretty new to Webpack and Rails 6 so I do not really know if I should add other information.

Thank you in advance!

bug views-and-styles

Most helpful comment

Ok so I managed to resolve the issue and the solution was pretty simple: I was pushing the wrong branch to Heroku, obviously leading to the error mentioned above. I am therefore closing this issue.

All 6 comments

Would you be able to provide a minimal repo reproducing the issue?

@sedubois I will do so today and then send you the link :)

@sedubois I can't manage to create a minimal repo reproducing the issue. Can I send you the link to the actual one?

@gabrielguerin you can always share something here in case someone has an idea, but if the code can't be narrowed down it will be more difficult to understand.

@sedubois here is the current repository. I will try again today and advise you if I succeed.

Ok so I managed to resolve the issue and the solution was pretty simple: I was pushing the wrong branch to Heroku, obviously leading to the error mentioned above. I am therefore closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

dbryand picture dbryand  路  3Comments

rmarronnier picture rmarronnier  路  4Comments

steffenix picture steffenix  路  4Comments

stephenson picture stephenson  路  3Comments