i'm using Rails 6 and every time i try to run
bundle exec rails webpacker:compile RAILS_ENV=production
I have a rails app running on Nginx + Passenger.
I got the following error
ModuleNotFoundError: Module not found: Error: Can't resolve 'gritter' in '/var/www/html/tesis/app/javascript/packs'
at /var/www/html/tesis/node_modules/webpack/lib/Compilation.js:925:10
at /var/www/html/tesis/node_modules/webpack/lib/NormalModuleFactory.js:401:22
at /var/www/html/tesis/node_modules/webpack/lib/NormalModuleFactory.js:130:21
at /var/www/html/tesis/node_modules/webpack/lib/NormalModuleFactory.js:224:22
at /var/www/html/tesis/node_modules/neo-async/async.js:2830:7
at /var/www/html/tesis/node_modules/neo-async/async.js:6877:13
at /var/www/html/tesis/node_modules/webpack/lib/NormalModuleFactory.js:214:25
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /var/www/html/tesis/node_modules/webpack/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
at _next42 (eval at create (/var/www/html/tesis/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
resolve 'gritter' in '/var/www/html/tesis/app/javascript/packs'
Parsed request is a module
using description file: /var/www/html/tesis/package.json (relative path: ./app/javascript/packs)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
looking for modules in /var/www/html/tesis/app/javascript
using description file: /var/www/html/tesis/package.json (relative path: ./app/javascript)
Field 'browser' doesn't contain a valid alias configuration
using description file: /var/www/html/tesis/package.json (relative path: ./app/javascript/gritter)
no extension
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.js doesn't exist
.sass
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.sass doesn't exist
.scss
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.scss doesn't exist
.css
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.css doesn't exist
.module.sass
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.module.sass doesn't exist
.module.scss
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.module.scss doesn't exist
.module.css
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.module.css doesn't exist
.png
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.png doesn't exist
.svg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.svg doesn't exist
.gif
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.gif doesn't exist
.jpeg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.jpeg doesn't exist
.jpg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/app/javascript/gritter.jpg doesn't exist
as directory
/var/www/html/tesis/app/javascript/gritter doesn't exist
/var/www/html/tesis/app/javascript/packs/node_modules doesn't exist or is not a directory
/var/www/html/tesis/app/javascript/node_modules doesn't exist or is not a directory
/var/www/html/tesis/app/node_modules doesn't exist or is not a directory
/var/www/html/node_modules doesn't exist or is not a directory
/var/www/node_modules doesn't exist or is not a directory
/var/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /var/www/html/tesis/node_modules
using description file: /var/www/html/tesis/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /var/www/html/tesis/package.json (relative path: ./node_modules/gritter)
no extension
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.js doesn't exist
.sass
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.sass doesn't exist
.scss
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.scss doesn't exist
.css
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.css doesn't exist
.module.sass
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.module.sass doesn't exist
.module.scss
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.module.scss doesn't exist
.module.css
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.module.css doesn't exist
.png
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.png doesn't exist
.svg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.svg doesn't exist
.gif
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.gif doesn't exist
.jpeg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.jpeg doesn't exist
.jpg
Field 'browser' doesn't contain a valid alias configuration
/var/www/html/tesis/node_modules/gritter.jpg doesn't exist
as directory
/var/www/html/tesis/node_modules/gritter doesn't exist
I tried manually doing yarn add gritter but is not working. Any ideas? I've been stuck with this for a while. Removing webpacker and install it again, precompile the assets, etc are thing i tried too.
Related
When attempting to compile I get the following errors for all images:
rails assets:precompile
ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es.symbol' in '/***/app/javascript/packs'
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.scss doesn't exist
.css
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.css doesn't exist
.module.sass
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.sass doesn't exist
.module.scss
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.scss doesn't exist
.module.css
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.module.css doesn't exist
.png
Field 'browser' doesn't contain a valid alias configuration
/*/app/javascript/core-js/modules/es.symbol.png doesn't exist
.svg
so I get
Webpacker::Manifest::MissingEntryError in Pages#home
I have installed webpacker by adding in my gemfile
gem 'webpacker'
and
bundle
bundle exec rails webpacker:install
yarn upgrade
yarn install
The folder packs in app/javascript was not created, so I created it myself and added my current application.js which was in app/assets to app/javascript/packs/
I added this to the top of the file:
import 'core-js/stable'
import 'regenerator-runtime/runtime'
const images = require.context('../images', true)
const imagePath = (name) => images(name, true)
And I did replace all tags with
javascript_pack_tag
or
asset_pack_path
but my manifest file looks anyways like:
{
"application.js": "/packs/js/application-e4e1539847422.js",
"application.js.map": "/packs/js/application-e4e15391747422.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-e4e15391a97422.js"
],
"js.map": [
"/packs/js/application-e4391598747422.js.map"
]
}
}
}
Without changing anything apparently the images get compiled correctly and when I Have access to my app the javascript does not work.
Delete this files and folders:
/node_modules
/tmp/cache
yarn.lock
Gemfile.lock
and then run:
bundle install
rails webpacker:install
rails assets:precompile
rails webpacker:compile
Where do you find a .gemspec file related to a gem?
For example; Rapidfire for implementation of another gem into its engine?
Where are these .gemspec files located because I can't for the life of me find it and I've checked every folder associated with Rapidfire
Gem::Specification.new do |s|
s.add_dependency "devise"
end
Where do I add this to make Devise work in Rapidfire?
.gemspec files are located in the root of the repo. For example, here you can find the rapidfire.gemspec
Then the gem is packaged, the spec is serialized into a Ruby structured and stored in the metadata file within the gem.
If you download a gem, and rename the file from .gem to .zip (a .gem is essentially a zip file) you can explore its content. You'll find a metadata.gz file that is a compressed file, that stores the .gemspec data.
--- !ruby/object:Gem::Specification
name: rapidfire
version: !ruby/object:Gem::Version
version: 2.1.0
platform: ruby
authors:
- Yuva Kumar
autorequire:
bindir: bin
cert_chain: []
date: 2015-02-19 00:00:00.000000000 Z
...
Rails comes with SASS included, but generated files come with .scss extension. I want to use indented version of SASS. Should I just rename .scss extension to .sass and that will do the trick? or should I do some extra dances to make it work?
Failed to load /home/searching/.gemrc because it doesn't contain valid YAML
when i excute this command rspec spec/
the above error will appear and not able to do the test case using spec
.gemrc is not Gemfile.
.gemrc are YAML files with the following YAML keys:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:gempath: The paths in which to look for gems
:disable_default_gem_server: Force specification of gem server host on push
<gem_command>: A string containing arguments for the specified gem command
Example:
:verbose: false
install: --no-wrappers
update: --no-wrappers
:disable_default_gem_server: true
It is described in details here: http://guides.rubygems.org/command-reference/
I am trying to use the rails 3.1 asset pipeline to include a javascript file from the manifest file's parent directory
app/assets/javascripts/folder/index.js
//=require ../file
yields: couldn't find file 'file'
How do I require a file from the parent directory?
Assets in Sprockets are always referenced by their logical path.
So you just have to use //=require file if your file is in /app/assets/javascripts.
If your file was /lib/assets/javascripts/models/lala.js for instance, you would require it with //=require models/lala.