远程:预编译资产失败。在heroku上(Rails 6和语义UI)

时间:2020-01-23 19:09:28

标签: ruby-on-rails heroku webpack semantic-ui ruby-on-rails-6

我正在尝试将Rails 6应用程序上的ruby部署到heroku,并且得到:

#takes group object applys a group by civil twilight groupby then takes the avearge of several columns
funct_day_night = lambda x: [x['Severity'].mean(), x["Distance(mi)"].mean(), x['Severity'].count()]
group_group_df = group_df.apply(lambda g_df : g_df.groupby('Civil_Twilight').apply(funct_day_night))
group_group_df

这样做时,我已经尝试过this

...
remote:        I, [2020-01-23T18:51:26.163296 #1627]  INFO -- : Writing /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/public/assets/semantic-ui/brand-icons-42e369dc8c372973ba77a826b62d2c7a2070532313df832a23288ddb76974158.ttf
remote:        I, [2020-01-23T18:51:26.163727 #1627]  INFO -- : Writing /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/public/assets/semantic-ui/brand-icons-42e369dc8c372973ba77a826b62d2c7a2070532313df832a23288ddb76974158.ttf.gz
remote:        I, [2020-01-23T18:51:26.164090 #1627]  INFO -- : Writing /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/public/assets/semantic-ui/brand-icons-6519a15b08294be395ed914c40236ba604214cb1163b5311a9875f1df5eed86d.svg
remote:        I, [2020-01-23T18:51:26.164873 #1627]  INFO -- : Writing /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/public/assets/semantic-ui/brand-icons-6519a15b08294be395ed914c40236ba604214cb1163b5311a9875f1df5eed86d.svg.gz
remote:        Compiling...
remote:        Compilation failed:
remote:        ModuleNotFoundError: Module not found: Error: Can't resolve 'semantic-ui-sass' in '/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/packs'
remote:            at factory.create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/lib/Compilation.js:925:10)
remote:            at factory (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
remote:            at resolver (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
remote:            at asyncLib.parallel (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
remote:            at /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/neo-async/async.js:2830:7
remote:            at /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/neo-async/async.js:6877:13
remote:            at normalResolver.resolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
remote:            at doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at resolver.doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote:            at resolver.doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn41 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
remote:            at resolver.doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn1 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote:            at args (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/forEachBail.js:30:14)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at resolver.doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote:            at resolver.doResolve (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn42 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
remote:            at hook.callAsync (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
remote:            at _fn0 (eval at create (/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
remote:        resolve 'semantic-ui-sass' in '/tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/packs'
remote:          Parsed request is a module
remote:          using description file: /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/package.json (relative path: ./app/javascript/packs)
remote:            Field 'browser' doesn't contain a valid alias configuration
remote:            resolve as module
remote:              looking for modules in /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript
remote:                using description file: /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/package.json (relative path: ./app/javascript)
remote:                  Field 'browser' doesn't contain a valid alias configuration
remote:                  using description file: /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/package.json (relative path: ./app/javascript/semantic-ui-sass)
remote:                    no extension
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass doesn't exist
remote:                    .mjs
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.mjs doesn't exist
remote:                    .js
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.js doesn't exist
remote:                    .sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.sass doesn't exist
remote:                    .scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.scss doesn't exist
remote:                    .css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.css doesn't exist
remote:                    .module.sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.module.sass doesn't exist
remote:                    .module.scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.module.scss doesn't exist
remote:                    .module.css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.module.css doesn't exist
remote:                    .png
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.png doesn't exist
remote:                    .svg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.svg doesn't exist
remote:                    .gif
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.gif doesn't exist
remote:                    .jpeg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.jpeg doesn't exist
remote:                    .jpg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass.jpg doesn't exist
remote:                    as directory
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/semantic-ui-sass doesn't exist
remote:              /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/packs/node_modules doesn't exist or is not a directory
remote:              /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/javascript/node_modules doesn't exist or is not a directory
remote:              /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/app/node_modules doesn't exist or is not a directory
remote:              /tmp/node_modules doesn't exist or is not a directory
remote:              /node_modules doesn't exist or is not a directory
remote:              looking for modules in /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules
remote:                using description file: /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/package.json (relative path: ./node_modules)
remote:                  Field 'browser' doesn't contain a valid alias configuration
remote:                  using description file: /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/package.json (relative path: ./node_modules/semantic-ui-sass)
remote:                    no extension
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass doesn't exist
remote:                    .mjs
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.mjs doesn't exist
remote:                    .js
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.js doesn't exist
remote:                    .sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.sass doesn't exist
remote:                    .scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.scss doesn't exist
remote:                    .css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.css doesn't exist
remote:                    .module.sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.module.sass doesn't exist
remote:                    .module.scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.module.scss doesn't exist
remote:                    .module.css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.module.css doesn't exist
remote:                    .png
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.png doesn't exist
remote:                    .svg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.svg doesn't exist
remote:                    .gif
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.gif doesn't exist
remote:                    .jpeg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.jpeg doesn't exist
remote:                    .jpg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass.jpg doesn't exist
remote:                    as directory
remote:                      /tmp/build_f6fcbd9561d1b9a0ac9f0eb2c4fc1207/node_modules/semantic-ui-sass doesn't exist
remote:        
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed

错误仍然存​​在。然后我做了this

# config/application.rb
config.assets.initialize_on_precompile = false

在本地一切正常,但是如果我在本地打开样式,则不存在,并且如果我部署到heroku,则仍然存在相同的错误。 还尝试了this 但仍然会出现相同的错误。

2 个答案:

答案 0 :(得分:0)

我也在将Rails6 +语义UI应用程序部署到Heroku时遇到了这个问题-发布我的解决方案以防万一这对未来的人们有帮助:

发生这种情况是由于SemanticUI配置错误。我的app/javascript/packs/application.js拥有这个:

require("semantic-ui")

代替:

//= require("semantic-ui")

修复此行后,我的应用程序能够正确构建和部署。

答案 1 :(得分:0)

检查您的package.json

我只是遇到了同样的错误,发现我的 semantic-ui-sass 软件包在devdependecies部分中,因此没有安装在生产环境中。

$ yarn remove semantic-ui-sass

$ yarn add semantic-ui-sass --prod