这是前两天开的帖:
我的工作是 Go 开发,因为总听说 Ruby 、Rails 很吊,所以业余打算学学,选了《 Agile web development with Rails 6 》一书看的,折腾了 3 天准备放弃了,真的不值一学。
如果一项编程语言的入门,大量时间要花到折腾环境、各种乱七八糟的报错上而无法聚焦到语言、框架本身,那还谈什么提高?
当初学 Go 也就小半天搭了环境就开始写了,Rails 整了 3 天,每天十个小时,到现在rails new demo
都没跑起来,确切的说是没完全跑起来。
就不说了,rails new demo
各种报错,最后localhost:3000
访问到了,但是自从执行
了bin/rails generate controller Say hello goodbye
,历数我遇到的各种奇怪的报错,完全没有任何解决方案:
- 比如执行
bin/webpack-dev-server
报错:
node:internal/modules/cjs/loader:903
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
官方 github issure 各种说版本问题,还让在packge.json
加了scripts:
代码,换成webpack serve
啥的,没点用,我就奇怪了前端圈各种软件库啥的升级从来不考虑向后兼容吗?约定的命令说改就改,改了还没啥用,解决不了旧问题还制造一堆新问题。github 、stack overflow 、csdn 之流都没有任何解决方案:,
-
比如Cannot find module '@rails/webpacker'
报错:
-
比如rails new --webpack fails with "Don't know how to build task 'webpacker:install'"
报错:
-
比如Getting undefined method 'javascript_pack_tag' for
报错:
-
比如Command "webpack" not found
报错:
-
比如ActionView::Template::Error: Webpacker can't find application in /app/public/packs/manifest.json
报错:
…
…………
……………………
………………………………
$ bin/rails about
About your application's environment
Rails version 6.0.3.4
Ruby version ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
RubyGems version 3.1.4
Rack version 2.2.3
Middleware Webpacker::DevServerProxy, ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root /Users/coool/ruby/work/demo
Environment development
Database adapter sqlite3
Database schema version 0
package.json
文件是这样的:
{
"name": "demo",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"turbolinks": "^5.2.0",
"webpack": "^5.4.0"
},
"scripts": {
"serve": "webpack serve"
},
"version": "0.1.0",
"devDependencies": {
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
},
"babel": {
"presets": [
"./node_modules/@rails/webpacker/package/babel/preset.js"
]
},
"browserslist": [
"defaults"
]
}
可能 Rails 确实是殿堂级的框架,但是这个框架的门槛在云上,我在地上上不去……各种环境、升级、代理设置、global 翻墙都没用、版本不兼容、乱七八糟的报错,是我在写 Go 的时候从来没有遇到过的。
另外吐槽一下 Ruby-China 真的……不知道有多少人的耐心是 7 天,反正我这三天,每天十几个小时的折腾这些报错已经耗尽了耐心,放弃了。