【问题标题】:Compiling Rails / ReactJS not working in production (heroku), but working locally. CSSSyntaxError : MissedSemicolon编译 Rails / ReactJS 不在生产环境(heroku)中工作,但在本地工作。 CSSSyntaxError:错过分号
【发布时间】:2021-03-17 11:40:52
【问题描述】:

对于注释,我已经多次推送我的 Rails / ReactJS 应用程序,在 Heroku 上没有任何问题。

经过一些更改后,我尝试重新推送它,但出现以下错误 =>


-----> Building on the Heroku-18 stack
-----> Using buildpacks:
       1. heroku/nodejs
       2. heroku/ruby
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       USE_YARN_CACHE=true
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       engines.yarn (package.json):  unspecified (use default)
       
       Resolving node version 14.x...
       Downloading and installing node 14.16.0...
       Using default npm version: 6.14.11
       Resolving yarn version 1.22.x...
       Downloading and installing yarn (1.22.10)
       Installed yarn 1.22.10
       
-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.22.10
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.1: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.12.10" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-development@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-pure-annotations@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react@^16.8.0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react-dom@^16.8.0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react@^15.5.4 || ^16.0.0-0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react-dom@^15.5.4 || ^16.0.0-0".
       warning " > redux-form@8.3.7" has incorrect peer dependency "react@^16.4.2".
       warning " > webpack-dev-server@3.11.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       [4/4] Building fresh packages...
       Done in 54.06s.
       
-----> Build
       
-----> Pruning devDependencies
       yarn install v1.22.10
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.1: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.12.10" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-development@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-pure-annotations@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react@^16.8.0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react-dom@^16.8.0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react@^15.5.4 || ^16.0.0-0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react-dom@^15.5.4 || ^16.0.0-0".
       warning " > redux-form@8.3.7" has incorrect peer dependency "react@^16.4.2".
       warning " > webpack-dev-server@3.11.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       [4/4] Building fresh packages...
       warning Ignored scripts due to flag.
       Done in 10.51s.
       
-----> Caching build
       - yarn cache
       
-----> Build succeeded!
 !     This app may not specify any way to start a node process
       https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
 !     Unmet dependencies don't fail yarn install but may cause runtime issues
       https://github.com/npm/npm/issues/7494
-----> Ruby app detected
-----> Installing bundler 2.2.11
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
###### WARNING:
       Your app was upgraded to bundler 2.2.11.
       Previously you had a successful deploy with bundler 2.1.4.
       
       If you see problems related to the bundler version please refer to:
       https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues
       
-----> Using Ruby version: ruby-2.7.0
-----> Installing dependencies using bundler 2.2.11
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Your Gemfile lists the gem dotenv-rails (>= 0) more than once.
       You should probably keep only one of them.
       Remove any duplicate entries and specify the gem only once.
       While it's not a problem now, it could cause errors if you change the version of one of them later.
       Fetching gem metadata from https://rubygems.org/..........
       Fetching https://github.com/mailjet/mailjet-gem.git
       Using rake 13.0.3
       Using concurrent-ruby 1.1.7
       Using minitest 5.14.3
       Using thread_safe 0.3.6
       Using builder 3.2.4
       Using erubi 1.10.0
       Using mini_portile2 2.4.0
       Using crass 1.0.6
       Using rack 2.2.3
       Using nio4r 2.5.4
       Using websocket-extensions 0.1.5
       Using mini_mime 1.0.2
       Using jsonapi-renderer 0.2.2
       Using arel 9.0.0
       Using mimemagic 0.3.5
       Using public_suffix 4.0.6
       Using execjs 2.7.0
       Using base32 0.3.4
       Using bcrypt 3.1.16
       Using msgpack 1.3.3
       Using bundler 2.2.11
       Using mini_magick 4.11.0
       Using ffi 1.14.2
       Using multi_json 1.15.0
       Using carrierwave_backgrounder 0.0.2
       Using excon 0.78.1
       Using formatador 0.2.5
       Using mime-types-data 3.2020.1104
       Using ipaddress 0.8.3
       Using coffee-script-source 1.12.2
       Using method_source 1.0.0
       Using thor 1.0.1
       Using orm_adapter 0.5.0
       Fetching unf_ext 0.0.7.7
       Fetching dotenv 2.7.6
       Using foreman 0.87.2
       Using multi_xml 0.6.0
       Using jwt 2.2.2
       Using rotp 6.2.0
       Using useragent 0.16.10
       Using hashie 3.6.0
       Fetching http-accept 1.7.0
       Fetching netrc 0.11.0
       Installing dotenv 2.7.6
       Installing netrc 0.11.0
       Installing http-accept 1.7.0
       Using pg 1.2.3
       Using puma 3.12.6
       Using rb-fsevent 0.10.4
       Using redis 4.2.5
       Using tilt 2.0.10
       Using semantic_range 2.3.1
       Installing unf_ext 0.0.7.7 with native extensions
       Fetching stripe 5.30.0
       Using turbolinks-source 5.2.0
       Using i18n 1.8.7
       Using nokogiri 1.10.10
       Using rack-test 1.1.0
       Using websocket-driver 0.7.3
       Using mail 2.7.1
       Using marcel 0.3.3
       Using addressable 2.7.0
       Using autoprefixer-rails 10.2.0.0
       Using bootsnap 1.5.1
       Using warden 1.2.9
       Using sprockets 3.7.2
       Using rack-cors 1.1.1
       Using rack-proxy 0.6.5
       Installing stripe 5.30.0
       Using uglifier 4.2.0
       Using tzinfo 1.2.9
       Using ruby-vips 2.0.17
       Using streamio-ffmpeg 2.0.0
       Using mime-types 3.3.1
       Using coffee-script 2.4.1
       Using sassc 2.4.0
       Using rb-inotify 0.10.1
       Using figaro 1.2.0
       Using omniauth 1.9.0
       Using loofah 2.8.0
       Using turbolinks 5.2.1
       Using activesupport 5.2.4.4
       Using image_processing 1.12.1
       Using fog-core 2.2.3
       Using httparty 0.18.1
       Using font-awesome-sass 5.15.1
       Using sass-listen 4.0.0
       Using rails-html-sanitizer 1.3.0
       Using rails-dom-testing 2.0.3
       Using globalid 0.4.2
       Using activemodel 5.2.4.4
       Using case_transform 0.2
       Using groupdate 2.5.2
       Using jsonapi-serializers 1.0.1
       Using jbuilder 2.10.1
       Using fog-json 1.2.0
       Using fog-xml 0.1.3
       Using actionview 5.2.4.4
       Using activejob 5.2.4.4
       Using activerecord 5.2.4.4
       Using carrierwave 2.1.0
       Using sass 3.7.4
       Using actionpack 5.2.4.4
       Using arel-helpers 2.12.0
       Using carrierwave-video 0.6.0
       Using carrierwave-video-thumbnailer 0.1.4
       Using fog-aws 3.7.0
       Using friendly_id 5.4.2
       Using actioncable 5.2.4.4
       Using actionmailer 5.2.4.4
       Using active_model_serializers 0.10.10
       Using activestorage 5.2.4.4
       Using railties 5.2.4.4
       Using sprockets-rails 3.2.2
       Using carrierwave_direct 2.1.0
       Using coffee-rails 4.2.2
       Using responders 3.0.1
       Using rails 5.2.4.4
       Fetching dotenv-rails 2.7.6
       Using sass-rails 5.1.0
       Using webpacker 5.2.1
       Using forest_liana 5.4.0
       Using devise 4.7.3
       Fetching devise_token_auth 1.1.5
       Installing dotenv-rails 2.7.6
       Installing devise_token_auth 1.1.5
       Fetching unf 0.1.4
       Installing unf 0.1.4
       Fetching domain_name 0.5.20190701
       Installing domain_name 0.5.20190701
       Fetching http-cookie 1.0.3
       Installing http-cookie 1.0.3
       Fetching rest-client 2.1.0
       Installing rest-client 2.1.0
       Using mailjet 1.6.0 from https://github.com/mailjet/mailjet-gem.git (at master@675f75f)
       Bundle complete! 48 Gemfile dependencies, 124 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Removing bundler (2.1.4)
       Removing devise_token_auth (1.1.3)
       Removing simple_form (5.0.3)
       Bundle completed (9.33s)
       Cleaning up the bundler cache.
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.4.4/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.4.4/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/static.rb:111: warning: The called method `initialize' is defined here
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.4.4/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.4.4/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
       /tmp/build_e1471a4f/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.4.4/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
       yarn install v1.22.10
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@2.3.1: The platform "linux" is incompatible with this module.
       info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
       info fsevents@1.2.13: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.12.10" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-development@7.12.12" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-pure-annotations@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react@^16.8.0".
       warning " > @bumaga/tabs@0.2.0" has incorrect peer dependency "react-dom@^16.8.0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react@^15.5.4 || ^16.0.0-0".
       warning " > react-stripe-elements@6.1.2" has incorrect peer dependency "react-dom@^15.5.4 || ^16.0.0-0".
       warning " > redux-form@8.3.7" has incorrect peer dependency "react@^16.4.2".
       warning " > webpack-dev-server@3.11.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
       [4/4] Building fresh packages...
       Done in 51.78s.
       I, [2021-03-17T11:29:21.549633 #3503]  INFO -- : Writing /tmp/build_e1471a4f/public/assets/adhesion-b7f06c2d9ff4f288a034bc9110a5e730795b0207b75984d4483e6219b43bb0d1.svg
       I, [2021-03-17T11:29:21.550575 #3503]  INFO -- : Writing /tmp/build_e1471a4f/public/assets/adhesion-b7f06c2d9ff4f288a034bc9110a5e730795b0207b75984d4483e6219b43bb0d1.svg.gz
       I, [2021-03-17T11:29:24.153962 #3503]  INFO -- : Writing /tmp/build_e1471a4f/public/assets/README-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.md
       I, [2021-03-17T11:29:30.200009 #3503]  INFO -- : Writing /tmp/build_e1471a4f/public/assets/application-7a44779857db323d1bc9ccf63db9914a5ce8ff8d23f6f9beb9853fb60ff66e8c.css
       I, [2021-03-17T11:29:30.200642 #3503]  INFO -- : Writing /tmp/build_e1471a4f/public/assets/application-7a44779857db323d1bc9ccf63db9914a5ce8ff8d23f6f9beb9853fb60ff66e8c.css.gz
       Compiling...
       Compilation failed:
       CssSyntaxError: /tmp/build_e1471a4f/css/Routes-f5978686.css:900:4437: Missed semicolon
           at Input.error (/tmp/build_e1471a4f/node_modules/postcss/lib/input.js:128:16)
           at Parser.checkMissedSemicolon (/tmp/build_e1471a4f/node_modules/postcss/lib/parser.js:601:22)
           at Parser.decl (/tmp/build_e1471a4f/node_modules/postcss/lib/parser.js:284:46)
           at Parser.other (/tmp/build_e1471a4f/node_modules/postcss/lib/parser.js:164:12)
           at Parser.parse (/tmp/build_e1471a4f/node_modules/postcss/lib/parser.js:75:16)
           at parse (/tmp/build_e1471a4f/node_modules/postcss/lib/parse.js:17:12)
           at new LazyResult (/tmp/build_e1471a4f/node_modules/postcss/lib/lazy-result.js:64:16)
           at Processor.<anonymous> (/tmp/build_e1471a4f/node_modules/postcss/lib/processor.js:142:12)
           at Processor.process (/tmp/build_e1471a4f/node_modules/postcss/lib/processor.js:121:23)
           at Function.creator.process (/tmp/build_e1471a4f/node_modules/postcss/lib/postcss.js:148:43)
           at OptimizeCssAssetsWebpackPlugin.processCss (/tmp/build_e1471a4f/node_modules/optimize-css-assets-webpack-plugin/src/index.js:73:21)
           at Object.processor (/tmp/build_e1471a4f/node_modules/optimize-css-assets-webpack-plugin/src/index.js:13:18)
           at /tmp/build_e1471a4f/node_modules/last-call-webpack-plugin/src/index.js:150:10
           at arrayEach (/tmp/build_e1471a4f/node_modules/lodash/_arrayEach.js:15:9)
           at forEach (/tmp/build_e1471a4f/node_modules/lodash/forEach.js:38:10)
           at OptimizeCssAssetsWebpackPlugin.process (/tmp/build_e1471a4f/node_modules/last-call-webpack-plugin/src/index.js:147:5)
           at /tmp/build_e1471a4f/node_modules/last-call-webpack-plugin/src/index.js:178:28
           at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:17)
           at AsyncSeriesHook.lazyCompileHook (/tmp/build_e1471a4f/node_modules/tapable/lib/Hook.js:154:20)
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1409:36
           at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
           at AsyncSeriesHook.lazyCompileHook (/tmp/build_e1471a4f/node_modules/tapable/lib/Hook.js:154:20)
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1405:32
           at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
           at AsyncSeriesHook.lazyCompileHook (/tmp/build_e1471a4f/node_modules/tapable/lib/Hook.js:154:20)
           at Compilation.seal (/tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1342:27)
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compiler.js:675:18
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1261:4
           at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
           at AsyncSeriesHook.lazyCompileHook (/tmp/build_e1471a4f/node_modules/tapable/lib/Hook.js:154:20)
           at Compilation.finish (/tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1253:28)
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compiler.js:672:17
           at _done (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
           at eval (eval at create (/tmp/build_e1471a4f/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:620:22)
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1185:12
           at /tmp/build_e1471a4f/node_modules/webpack/lib/Compilation.js:1097:9
       
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

我尝试了很多事情:

  • 删除一些最近的包
  • 检查每一行代码并更新所有缺少分号的 JS 和 SCSS 文件
  • 删除 heroku buildpack 并重新添加它们。
  • 创建一个新的 Heroku 应用

所有这些尝试都给了我同样的错误。

我真的不知道在哪里搜索了。

提前感谢您的帮助。

这里有一些文件可以帮助您随时向我询问更多输出或文件。

Package.json

{
  "name": "testapp",
  "private": true,
  "dependencies": {
    "@babel/preset-react": "^7.12.10",
    "@bumaga/tabs": "^0.2.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.34",
    "@fortawesome/free-solid-svg-icons": "^5.15.2",
    "@fortawesome/react-fontawesome": "^0.1.14",
    "@rails/webpacker": "5.2.1",
    "axios": "^0.21.1",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
    "final-form": "^4.20.1",
    "history": "^5.0.0",
    "j-toker": "^0.0.10-beta3",
    "jquery": "^3.5.1",
    "jquery-deparam": "^0.5.3",
    "jquery.cookie": "^1.4.1",
    "moment": "^2.29.1",
    "pdfmake": "^0.1.70",
    "polyfill": "^0.1.0",
    "prop-types": "^15.7.2",
    "pubsub-js": "^1.9.2",
    "query-string": "^6.14.1",
    "react": "^17.0.1",
    "react-app-polyfill": "^2.0.0",
    "react-content-loader": "^6.0.1",
    "react-datepicker": "^3.6.0",
    "react-dom": "^17.0.1",
    "react-dropzone": "^11.3.1",
    "react-final-form": "^6.5.2",
    "react-helmet": "^6.1.0",
    "react-modal": "^3.12.1",
    "react-redux": "^7.2.2",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "react-share": "^4.3.1",
    "react-stripe-elements": "^6.1.2",
    "redux": "^4.0.5",
    "redux-form": "^8.3.7",
    "redux-logger": "^3.0.6",
    "redux-promise": "^0.6.0",
    "redux-thunk": "^2.3.0",
    "script-loader": "^0.7.2"
  },
  "devDependencies": {
    "webpack-dev-server": "^3.11.1"
  }
}

【问题讨论】:

  • 在生产环境中,资产使用 RAILS_ENV=production 进行预编译。在本地运行它,看看它是否通过:NODE_ENV=production ./bin/webpack
  • 或在webpacker.yml 中设置compile: truedevelopment。在预编译步骤引发错误
  • 感谢您的回复。我跑了NODE_ENV=production ./bin/webpack,它顺利通过了。对于您的第二条评论,从一开始compile 就在true 上为development
  • 创建一个新的 heroku 应用程序并在没有失败的 css 的情况下进行部署。缩小问题范围。

标签: ruby-on-rails reactjs heroku webpack webpacker


【解决方案1】:

您可以通过以下方式提供更多日志信息:

该信息是相关的,因为它说明了它正在使用哪个 npm 和节点版本。将其与您的本地节点和 npm 版本进行比较。它也可能会说它无法安装某些软件包。显示的错误将是一个连续的错误。

  "devDependencies": {
    "webpack-dev-server": "^3.11.1"
  }

您将 webpack-dev-server 列为开发依赖项。您确定在部署/生产中不需要它吗?

【讨论】:

  • 感谢您的快速回答。对不起,也许不清楚,这已经是 heroku 日志错误。我已经用完整的构建日志更新了它。我将webpack-dev-server 添加到我的错误中。
  • 更新的日志显示您在安装依赖项时遇到问题。在继续将其托管在 Heroku 上之前,请确保您的代码在 Linux 上正常运行。
  • Eveyrthing 在我的 Mac 上本地运行良好。我真的不知道如何确保我的代码在 Linux 上运行,我以前从未遇到过这种问题,我会尝试挖掘......
猜你喜欢
  • 2021-12-08
  • 2014-04-27
  • 2016-07-16
  • 2018-03-23
  • 2019-08-17
  • 1970-01-01
  • 2017-09-11
  • 2016-01-14
  • 2015-05-15
相关资源
最近更新 更多