gpt4 book ai didi

javascript - Rails 网络应用程序 : Rack app error handling request { GET/packs/js/application-682c14949987e19a8380. js }

转载 作者:行者123 更新时间:2023-12-04 17:26:16 30 4
gpt4 key购买 nike

当我在本地版本的 Rails 6 应用程序上加载主页 View (或任何 View )时,我通过本地主机使用 webpack-dev-server 运行该应用程序,页面将加载,但不会加载 javascript,因为我当 webpack 在我的 app/javascript/packs 目录中调用 application.js 时,继续出现以下内部服务器错误:

    2020-07-28 18:04:57 -0500: HTTP parse error, malformed request ():
#<Puma::HttpParserError: Invalid HTTP format, parsing fails.

---
2020-07-28 18:04:57 -0500: Rack app error handling request { GET /packs/js/application-682c14949987e19a8380.js }

#<OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: wrong version number>

后跟一些更无关/含糊的信息。当我运行 bin/webpack-dev-server 时,一切(我假设)都很顺利:

ℹ 「wds」: Project is running at https://localhost:3000/

ℹ 「wds」: webpack output is served from /packs/

ℹ 「wds」: Content not from webpack is served from /home/gabe/domus/public/packs

ℹ 「wds」: 404s will fallback to /index.html

ℹ 「wdm」: Hash: 6c3a88060d923134f5c3

Version: webpack 4.44.0

Time: 1399ms

Built at: 07/28/2020 5:51:22 PM

Asset Size Chunks Chunk Names

js/application-682c14949987e19a8380.js 508 KiB application [emitted] [immutable] application

js/application-682c14949987e19a8380.js.map 572 KiB application [emitted] [dev] application

manifest.json 364 bytes [emitted]

ℹ 「wdm」: Compiled successfully.

在我的 application.html.slim 文件中,我使用 javascript_pack_tag 调用 application.js 文件:

html
head
title Domus
= csrf_meta_tags
= csp_meta_tag

= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'

body
= yield

我的 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
check_yarn_integrity: false
webpack_compile_output: true

resolved_paths: []

cache_manifest: false

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

check_yarn_integrity: true

dev_server:
https: true
host: localhost
port: 3000
public: localhost:3000
hmr: false
inline: false
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/**'

我不太确定还能尝试什么。任何帮助将不胜感激!

最佳答案

我通过先运行 bin/webpack-dev-server 然后运行 ​​rails s 来解决这个问题

关于javascript - Rails 网络应用程序 : Rack app error handling request { GET/packs/js/application-682c14949987e19a8380. js },我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63144399/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com