Can't Heroku push, failed to compile Rails

428 views Asked by At

I have tried many times to git push heroku master my testing app and i always run to the same issue. I have been over many solutions from heroku push rejected, failed to compile Ruby app but none worked.

Here is my error message from terminal

Compilation failed:
       ModuleNotFoundError: Module not found: Error: Can't resolve 'stylesheets/application.scss' in '/tmp/build_3e3bc14f/app/javascript/packs'
           at /tmp/build_3e3bc14f/node_modules/webpack/lib/Compilation.js:925:10
           at /tmp/build_3e3bc14f/node_modules/webpack/lib/NormalModuleFactory.js:401:22
           at /tmp/build_3e3bc14f/node_modules/webpack/lib/NormalModuleFactory.js:130:21
           at /tmp/build_3e3bc14f/node_modules/webpack/lib/NormalModuleFactory.js:224:22
           at /tmp/build_3e3bc14f/node_modules/neo-async/async.js:2830:7
           at /tmp/build_3e3bc14f/node_modules/neo-async/async.js:6877:13
           at /tmp/build_3e3bc14f/node_modules/webpack/lib/NormalModuleFactory.js:214:25
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:213:14
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/Resolver.js:285:5
           at eval (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
           at /tmp/build_3e3bc14f/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
           at _next42 (eval at create (/tmp/build_3e3bc14f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
       resolve 'stylesheets/application.scss' in '/tmp/build_3e3bc14f/app/javascript/packs'
         Parsed request is a module
         using description file: /tmp/build_3e3bc14f/package.json (relative path: ./app/javascript/packs)
           Field 'browser' doesn't contain a valid alias configuration
           resolve as module
             looking for modules in /tmp/build_3e3bc14f/app/javascript
               using description file: /tmp/build_3e3bc14f/package.json (relative path: ./app/javascript)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_3e3bc14f/package.json (relative path: ./app/javascript/stylesheets/application.scss)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss.jpg doesn't exist
                   as directory
                     /tmp/build_3e3bc14f/app/javascript/stylesheets/application.scss doesn't exist
             /tmp/build_3e3bc14f/app/javascript/packs/node_modules doesn't exist or is not a directory
             /tmp/build_3e3bc14f/app/javascript/node_modules doesn't exist or is not a directory
             /tmp/build_3e3bc14f/app/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_3e3bc14f/node_modules
               using description file: /tmp/build_3e3bc14f/package.json (relative path: ./node_modules)
                 Field 'browser' doesn't contain a valid alias configuration
                 using description file: /tmp/build_3e3bc14f/package.json (relative path: ./node_modules/stylesheets/application.scss)
                   no extension
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss doesn't exist
                   .mjs
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.mjs doesn't exist
                   .js
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.js doesn't exist
                   .sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.sass doesn't exist
                   .scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.scss doesn't exist
                   .css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.css doesn't exist
                   .module.sass
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.module.sass doesn't exist
                   .module.scss
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.module.scss doesn't exist
                   .module.css
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.module.css doesn't exist
                   .png
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.png doesn't exist
                   .svg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.svg doesn't exist
                   .gif
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.gif doesn't exist
                   .jpeg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.jpeg doesn't exist
                   .jpg
                     Field 'browser' doesn't contain a valid alias configuration
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss.jpg doesn't exist
                   as directory
                     /tmp/build_3e3bc14f/node_modules/stylesheets/application.scss doesn't exist
       
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

Gemfile

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.3'
# ruby '2.6.6'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.0.4', '>= 6.0.4.4'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

gem 'devise'

gem 'autoprefixer-rails', '10.2.5'
gem 'font-awesome-sass'
gem 'simple_form'
gem 'faker'

group :development, :test do  gem 'pry-byebug'
  gem 'pry-rails'
  gem 'dotenv-rails'

  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

package.json

{
  "name": "product_hunt_clone",
  "private": true,
  "dependencies": {
    "@rails/actioncable": "^6.0.0",
    "@rails/activestorage": "^7.0.1",
    "@rails/ujs": "^6.0.0",
    "@rails/webpacker": "5.4.3",
    "bootstrap": "4.6",
    "jquery": "^3.6.0",
    "popper.js": "^1.16.1",
    "turbolinks": "^5.2.0",
    "webpack": "^4.46.0",
    "webpack-cli": "^3.3.12"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3"
  }
}

webpacker.yml

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  webpack_compile_output: true

  # Additional paths webpack should lookup modules
  # ['app/assets', 'engine/foo/app/assets']
  additional_paths: []

  # Reload manifest.json on all requests so we reload latest compiled packs
  cache_manifest: false

  # Extract and emit a css file
  extract_css: false

  static_assets_extensions:
    - .jpg
    - .jpeg
    - .png
    - .gif
    - .tiff
    - .ico
    - .svg
    - .eot
    - .otf
    - .ttf
    - .woff
    - .woff2

  extensions:
    - .mjs
    - .js
    - .sass
    - .scss
    - .css
    - .module.sass
    - .module.scss
    - .module.css
    - .png
    - .svg
    - .gif
    - .jpeg
    - .jpg

development:
  <<: *default
  compile: true

  # Reference: https://webpack.js.org/configuration/dev-server/
  dev_server:
    https: false
    host: localhost
    port: 3035
    public: localhost:3035
    hmr: false
    # Inline should be set to true if using HMR
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    pretty: false
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options:
      ignored: '**/node_modules/**'


test:
  <<: *default
  compile: true

  # Compile test packs to a separate directory
  public_output_path: packs-test

production:
  <<: *default

  # Production depends on precompilation of packs prior to booting for performance.
  compile: false

  # Extract and emit a css file
  extract_css: true

  # Cache manifest.json for performance
  cache_manifest: true

Any chance you can see what's is going on?

i also have tried so far: -bundle update webpacker -rails assets:precompile

0

There are 0 answers