How can I regenerate webpacker's manifest.json file?
I'm getting the below error in my terminal when trying to start rails server.
/.rvm/gems/ruby-2.7.1/gems/webpacker-5.1.1/lib/webpacker/manifest.rb:84:in `parse':
An empty string is not a valid JSON string. (JSON::ParserError)
This is the offending lines from manifest.rbdef load if config.public_manifest_path.exist? JSON.parse config.public_manifest_path.read else {} end end
Through some debugging, I've discovered that my manifest.json file is empty, which is causing the error.
Does anyone know how this file can be regenerated?
Hey Brian,
What exactly are you trying to do? I can imagine this would fail if you haven't run
A safer version of your code might be the following, but it still won't solve your problem from having no manifest (which is created on webpacker:compile)
What exactly are you trying to do? I can imagine this would fail if you haven't run
bin/webpack
yet.A safer version of your code might be the following, but it still won't solve your problem from having no manifest (which is created on webpacker:compile)
def load JSON.parse config.public_manifest_path.read rescue {} end
I used NPM to install wavesurfer.js as I'm looking for a wave form generator. After the the install, rails server would not start because of the error posted, which led me to find the empty manifest file.
Ultimately, I just used a version of the manifest file from a few days before that got me back up and running and I have not been able to recreate the problem again. So not really sure what happened....
Thanks for the code suggestions, and the response.
Ultimately, I just used a version of the manifest file from a few days before that got me back up and running and I have not been able to recreate the problem again. So not really sure what happened....
Thanks for the code suggestions, and the response.
Notifications
You’re not receiving notifications from this thread.