如何解决我无法在我的 Rails 应用程序中创建 manifest.json
我正在尝试从 TheOdinProject 启动一个示例 Rails 应用程序。它只创建一个应用程序,为汽车创建一个表,然后迁移它。在本地主机中运行应用程序时,它显示 Webpacker::Manifest::MissingEntryError。 看起来在启动应用程序时没有创建 manifest.json。我尝试了互联网上的不同解决方案,包括从头开始删除和重新安装 node_modules、实现处理测试的方法等等。
{
"name": "foo","private": true,"dependencies": {
"@rails/actioncable": "^6.0.0","@rails/activestorage": "^6.0.0","@rails/ujs": "^6.0.0","turbolinks": "^5.2.0"
},"version": "0.1.0","devDependencies": {
"webpack-dev-server": "^3.11.2"
}
}
这是我的 package.json。我注意到它没有“@rails/webpacker”作为依赖项。 希望您能够帮助我。 这是我的 Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.2'
# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','~> 6.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3','~> 1.4'
# Use Puma as the app server
gem 'puma','~> 5.0'
# 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.4',require: false
group :development,:test do
# 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','>= 4.1.0'
# display performance information such as sql time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem 'rack-mini-profiler','~> 2.0'
gem 'listen','~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara','>= 3.26'
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]
解决方法
我找到了问题所在。这是我的节点版本。我使用的是最新的但不是 LTS,所以没有安装一些像 node-sass 这样的软件包。我降级了,现在一切正常。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。