New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve rails-ujs #3898

Closed
BastienDurel opened this Issue Jun 22, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@BastienDurel
Copy link

BastienDurel commented Jun 22, 2017

Hello. I have an issue since I upgraded to 1.4.x (got it on 1.4.1, then moved forward to 1.4.4 and still got it)

asset precompilation fails with error Module not found: Error: Can't resolve 'rails-ujs' in '/home/mastodon/live/app/javascript/packs'

Additionnaly (but it may be related), http requests to static files (/pack/anything) fails with 404 errors.

I ran bundle install and yarn install, multiple times, without success.
I tried to add rails-ujs in Gemfile but neither succeed.

I tried asking on IRC, but where redirected here.

Here is the full error message :

Webpacker is installed 🎉 🍰
Using /home/mastodon/live/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets 🎉
[Webpacker] Compilation Failed
yarn run v0.24.6
$ "/home/mastodon/live/node_modules/.bin/webpack" --config /home/mastodon/live/config/webpack/production.js
Hash: 665603d4e825685a6cfd
Time: 56265ms
 [477] ./app/javascript/packs/application.js 165 bytes {3} [built]
 [478] ./app/javascript/packs/common.js 43 bytes {35} [built]
 [479] ./app/javascript/packs/public.js 3.18 kB {34} [built]
 [480] ./tmp/packs/locale_ar.js 325 bytes {33} [built]
 [481] ./tmp/packs/locale_bg.js 325 bytes {32} [built]
 [482] ./tmp/packs/locale_ca.js 325 bytes {31} [built]
 [483] ./tmp/packs/locale_de.js 325 bytes {30} [built]
 [484] ./tmp/packs/locale_en.js 325 bytes {29} [built]
 [485] ./tmp/packs/locale_eo.js 325 bytes {28} [built]
 [486] ./tmp/packs/locale_es.js 325 bytes {27} [built]
 [487] ./tmp/packs/locale_fa.js 325 bytes {26} [built]
 [488] ./tmp/packs/locale_fi.js 325 bytes {25} [built]
 [489] ./tmp/packs/locale_fr.js 325 bytes {24} [built]
 [490] ./tmp/packs/locale_he.js 325 bytes {23} [built]
 [493] ./tmp/packs/locale_id.js 325 bytes {20} [built]
    + 1044 hidden modules

ERROR in ./app/javascript/packs/public.js
Module not found: Error: Can't resolve 'rails-ujs' in '/home/mastodon/live/app/javascript/packs'
 @ ./app/javascript/packs/public.js 3:0-37

ERROR in ./app/javascript/packs/common.js
Module not found: Error: Can't resolve 'rails-ujs' in '/home/mastodon/live/app/javascript/packs'
 @ ./app/javascript/packs/common.js 1:0-34
Child extract-text-webpack-plugin:
       [0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
       [1] ./~/font-awesome/fonts/fontawesome-webfont.eot 102 bytes {0} [built]
       [2] ./~/font-awesome/fonts/fontawesome-webfont.eot?v=4.7.0 102 bytes {0} [built]
       [3] ./~/font-awesome/fonts/fontawesome-webfont.svg?v=4.7.0 102 bytes {0} [built]
       [4] ./~/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0 102 bytes {0} [built]
       [5] ./~/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 104 bytes {0} [built]
       [6] ./~/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0 103 bytes {0} [built]
       [7] ./~/css-loader?{"minimize":true}!./~/postcss-loader/lib?{"sourceMap":true}!./~/resolve-url-loader!./~/sass-loader/lib/loader.js!./~/font-awesome/css/font-awesome.css 33.2 kB {0} [built]
Child extract-text-webpack-plugin:
       [0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
       [2] ./app/javascript/fonts/montserrat/Montserrat-Regular.woff 102 bytes {0} [built]
       [3] ./app/javascript/fonts/montserrat/Montserrat-Regular.woff2 103 bytes {0} [built]
       [4] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.svg 109 bytes {0} [built]
       [5] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.ttf 109 bytes {0} [built]
       [6] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff 110 bytes {0} [built]
       [7] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff2 111 bytes {0} [built]
       [8] ./app/javascript/fonts/roboto/roboto-bold-webfont.svg 102 bytes {0} [built]
       [9] ./app/javascript/fonts/roboto/roboto-bold-webfont.ttf 102 bytes {0} [built]
      [10] ./app/javascript/fonts/roboto/roboto-bold-webfont.woff 103 bytes {0} [built]
      [11] ./app/javascript/fonts/roboto/roboto-bold-webfont.woff2 104 bytes {0} [built]
      [12] ./app/javascript/fonts/roboto/roboto-italic-webfont.svg 104 bytes {0} [built]
      [13] ./app/javascript/fonts/roboto/roboto-italic-webfont.ttf 104 bytes {0} [built]
      [14] ./app/javascript/fonts/roboto/roboto-italic-webfont.woff 105 bytes {0} [built]
      [29] ./~/css-loader?{"minimize":true}!./~/postcss-loader/lib?{"sourceMap":true}!./~/resolve-url-loader!./~/sass-loader/lib/loader.js!./app/javascript/styles/application.scss 114 kB {0} [built]
        + 15 hidden modules
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed with exit code 2.

I tried this on alpine 3.6 with ruby 2.4.1 and on debian 9 with ruby 2.3.3, and got the same result

@BastienDurel

This comment has been minimized.

Copy link
Author

BastienDurel commented Jun 22, 2017

here is the full upgrade command

$ bundle install --deployment && yarn install && RAILS_ENV=production bundle exec rails assets:precompile

Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 12.0.0
Using pkg-config 1.2.3
Using puma 3.9.1
Using concurrent-ruby 1.0.5
Using i18n 0.8.4
Using minitest 5.10.2
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubi 1.6.0
Using mini_portile2 2.2.0
Using rack 2.0.3
Using nio4r 2.1.0
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 8.0.0
Using method_source 0.8.2
Using thor 0.19.4
Using bundler 1.15.1
Using execjs 2.7.0
Using temple 0.8.0
Using tilt 2.0.7
Using pg 0.20.0
Using dotenv 2.2.1
Using aws-sigv4 1.0.0
Using jmespath 1.3.1
Using climate_control 0.2.0
Using mimemagic 0.3.2
Using public_suffix 2.0.5
Using msgpack 1.1.0
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Fetching bcrypt 3.1.11
Installing bcrypt 3.1.11 with native extensions
Fetching orm_adapter 0.5.0
Installing orm_adapter 0.5.0
Fetching encryptor 3.0.0
Installing encryptor 3.0.0
Fetching rotp 2.1.2
Installing rotp 2.1.2
Fetching fast_blank 1.0.0
Installing fast_blank 1.0.0 with native extensions
Fetching unf_ext 0.0.7.4
Installing unf_ext 0.0.7.4 with native extensions
Fetching http-form_data 1.0.3
Installing http-form_data 1.0.3
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching hiredis 0.6.1
Installing hiredis 0.6.1 with native extensions
Fetching redis 3.3.3
Installing redis 3.3.3
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching http_accept_language 2.1.0
Installing http_accept_language 2.1.0
Fetching colorize 0.8.1
Installing colorize 0.8.1
Fetching kaminari-core 1.0.1
Installing kaminari-core 1.0.1
Fetching link_header 0.0.8
Installing link_header 0.0.8
Fetching oj 3.1.0
Installing oj 3.1.0 with native extensions
Fetching openssl 2.0.3
Installing openssl 2.0.3 with native extensions
Fetching ox 2.5.0
Installing ox 2.5.0 with native extensions
Fetching rack-cors 0.4.1
Installing rack-cors 0.4.1
Fetching rack-timeout 0.4.2
Installing rack-timeout 0.4.2
Fetching chunky_png 1.3.8
Installing chunky_png 1.3.8
Fetching ruby-oembed 0.12.0
Installing ruby-oembed 0.12.0
Fetching crass 1.0.2
Installing crass 1.0.2
Fetching connection_pool 2.2.1
Installing connection_pool 2.2.1
Fetching statsd-instrument 2.1.2
Installing statsd-instrument 2.1.2
Fetching multi_json 1.12.1
Installing multi_json 1.12.1
Fetching bigdecimal 1.3.2
Installing bigdecimal 1.3.2 with native extensions
Fetching tzinfo 1.2.3
Installing tzinfo 1.2.3
Fetching nokogiri 1.8.0
Installing nokogiri 1.8.0 with native extensions
Fetching rack-test 0.6.3
Installing rack-test 0.6.3
Fetching sprockets 3.7.1
Installing sprockets 3.7.1
Fetching warden 1.2.7
Installing warden 1.2.7
Fetching rack-attack 5.0.1
Installing rack-attack 5.0.1
Fetching rack-protection 2.0.0
Installing rack-protection 2.0.0
Fetching websocket-driver 0.6.5
Installing websocket-driver 0.6.5 with native extensions
Fetching mime-types 3.1
Installing mime-types 3.1
Fetching uglifier 3.2.0
Installing uglifier 3.2.0
Fetching hamlit 2.8.1
Installing hamlit 2.8.1 with native extensions
Fetching aws-sdk-core 2.9.37
Installing aws-sdk-core 2.9.37
Fetching cocaine 0.5.8
Installing cocaine 0.5.8
Fetching addressable 2.5.1
Installing addressable 2.5.1
Fetching bootsnap 1.0.0
Installing bootsnap 1.0.0 with native extensions
Fetching cld3 3.1.2
Installing cld3 3.1.2 with native extensions
Fetching attr_encrypted 3.0.3
Installing attr_encrypted 3.0.3
Fetching unf 0.1.4
Installing unf 0.1.4
Fetching redis-namespace 1.5.3
Installing redis-namespace 1.5.3
Fetching redis-store 1.3.0
Installing redis-store 1.3.0
Fetching httplog 0.99.3
Installing httplog 0.99.3
Fetching rqrcode 0.10.1
Installing rqrcode 0.10.1
Fetching activesupport 5.1.1
Installing activesupport 5.1.1
Fetching et-orbi 1.0.4
Installing et-orbi 1.0.4
Fetching tzinfo-data 1.2017.2
Installing tzinfo-data 1.2017.2
Fetching loofah 2.0.3
Installing loofah 2.0.3
Fetching nokogumbo 1.4.13
Installing nokogumbo 1.4.13 with native extensions
Fetching sidekiq 5.0.2
Installing sidekiq 5.0.2
Fetching mail 2.6.6
Installing mail 2.6.6
Fetching aws-sdk-resources 2.9.37
Installing aws-sdk-resources 2.9.37
Fetching av 0.9.0
Installing av 0.9.0
Fetching domain_name 0.5.20170404
Installing domain_name 0.5.20170404
Fetching twitter-text 1.14.5
Installing twitter-text 1.14.5
Fetching redis-rack 2.0.2
Installing redis-rack 2.0.2
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching globalid 0.4.0
Installing globalid 0.4.0
Fetching activemodel 5.1.1
Installing activemodel 5.1.1
Fetching pundit 1.1.0
Installing pundit 1.1.0
Fetching rabl 0.13.1
Installing rabl 0.13.1
Fetching simple-navigation 4.0.5
Installing simple-navigation 4.0.5
Fetching redis-activesupport 5.0.2
Installing redis-activesupport 5.0.2
Fetching rufus-scheduler 3.4.2
Installing rufus-scheduler 3.4.2
Fetching rails-html-sanitizer 1.0.3
Installing rails-html-sanitizer 1.0.3
Fetching sanitize 4.5.0
Installing sanitize 4.5.0
Fetching sidekiq-unique-jobs 5.0.8
Installing sidekiq-unique-jobs 5.0.8
Fetching sidekiq-bulk 0.1.1
Installing sidekiq-bulk 0.1.1
Fetching aws-sdk 2.9.37
Installing aws-sdk 2.9.37
Fetching http-cookie 1.0.3
Installing http-cookie 1.0.3
Fetching activejob 5.1.1
Installing activejob 5.1.1
Fetching activerecord 5.1.1
Installing activerecord 5.1.1
Fetching paperclip 5.1.0
Installing paperclip 5.1.0
Fetching sidekiq-scheduler 2.1.5
Installing sidekiq-scheduler 2.1.5
Fetching actionview 5.1.1
Installing actionview 5.1.1
Fetching http 2.2.2
Installing http 2.2.2
Fetching pghero 1.7.0
Installing pghero 1.7.0
Fetching kaminari-activerecord 1.0.1
Installing kaminari-activerecord 1.0.1
Fetching paperclip-av-transcoder 0.6.4
Installing paperclip-av-transcoder 0.6.4
Fetching actionpack 5.1.1
Installing actionpack 5.1.1
Fetching kaminari-actionview 1.0.1
Installing kaminari-actionview 1.0.1
Fetching goldfinger 1.2.0
Installing goldfinger 1.2.0
Fetching ostatus2 2.0.1
Installing ostatus2 2.0.1
Fetching actioncable 5.1.1
Installing actioncable 5.1.1
Fetching actionmailer 5.1.1
Installing actionmailer 5.1.1
Fetching railties 5.1.1
Installing railties 5.1.1
Fetching sprockets-rails 3.2.0
Installing sprockets-rails 3.2.0
Fetching simple_form 3.5.0
Installing simple_form 3.5.0
Fetching redis-actionpack 5.0.1
Installing redis-actionpack 5.0.1
Fetching kaminari 1.0.1
Installing kaminari 1.0.1
Fetching hamlit-rails 0.2.0
Installing hamlit-rails 0.2.0
Fetching dotenv-rails 2.2.1
Installing dotenv-rails 2.2.1
Fetching responders 2.4.0
Installing responders 2.4.0
Fetching doorkeeper 4.2.6
Installing doorkeeper 4.2.6
Fetching rails-i18n 5.0.4
Installing rails-i18n 5.0.4
Fetching webpacker 2.0
Installing webpacker 2.0
Fetching lograge 0.5.1
Installing lograge 0.5.1
Fetching rails 5.1.1
Installing rails 5.1.1
Fetching redis-rails 5.0.2
Installing redis-rails 5.0.2
Fetching devise 4.3.0
Installing devise 4.3.0
Fetching rails-settings-cached 0.6.5
Installing rails-settings-cached 0.6.5
Fetching devise-two-factor 3.0.0
Installing devise-two-factor 3.0.0
Bundle complete! 85 Gemfile dependencies, 137 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
Post-install message from paperclip:
##################################################
#  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER       #
##################################################

Paperclip is now compatible with aws-sdk >= 2.0.0.

If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
changes:

* You must set the `s3_region`
* If you are explicitly setting permissions anywhere, such as in an initializer,
  note that the format of the permissions changed from using an underscore to
  using a hyphen. For example, `:public_read` needs to be changed to
  `public-read`.

For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
Post-install message from encryptor:



Please be aware that Encryptor v2.0.0 had a major security bug when using AES-*-GCM algorithms.

By default You will not be able to decrypt data that was previously encrypted using an AES-*-GCM algorithm.

Please see the README and https://github.com/attr-encrypted/encryptor/pull/22 for more information.


Post-install message from attr_encrypted:



WARNING: Several insecure default options and features were deprecated in attr_encrypted v2.0.0.

Additionally, there was a bug in Encryptor v2.0.0 that insecurely encrypted data when using an AES-*-GCM algorithm.

This bug was fixed but introduced breaking changes between v2.x and v3.x.

Please see the README for more information regarding upgrading to attr_encrypted v3.0.0.


yarn install v0.24.6
[1/5] Resolving packages...
success Already up-to-date.
$ npm rebuild node-sass

> node-sass@4.5.3 install /home/mastodon/live/node_modules/node-sass
> node scripts/install.js

node-sass build Binary found at /home/mastodon/live/node_modules/node-sass/vendor/linux-x64-48/binding.node

> node-sass@4.5.3 postinstall /home/mastodon/live/node_modules/node-sass
> node scripts/build.js

Binary found at /home/mastodon/live/node_modules/node-sass/vendor/linux-x64-48/binding.node
Testing binary
Binary is fine
node-sass@4.5.3 /home/mastodon/live/node_modules/node-sass
Done in 5.01s.
Webpacker is installed 🎉 🍰
Using /home/mastodon/live/config/webpacker.yml file for setting up webpack paths
[Webpacker] Compiling assets 🎉
[Webpacker] Compilation Failed
yarn run v0.24.6
$ "/home/mastodon/live/node_modules/.bin/webpack" --config /home/mastodon/live/config/webpack/production.js
Hash: 665603d4e825685a6cfd
Time: 56265ms
 [477] ./app/javascript/packs/application.js 165 bytes {3} [built]
 [478] ./app/javascript/packs/common.js 43 bytes {35} [built]
 [479] ./app/javascript/packs/public.js 3.18 kB {34} [built]
 [480] ./tmp/packs/locale_ar.js 325 bytes {33} [built]
 [481] ./tmp/packs/locale_bg.js 325 bytes {32} [built]
 [482] ./tmp/packs/locale_ca.js 325 bytes {31} [built]
 [483] ./tmp/packs/locale_de.js 325 bytes {30} [built]
 [484] ./tmp/packs/locale_en.js 325 bytes {29} [built]
 [485] ./tmp/packs/locale_eo.js 325 bytes {28} [built]
 [486] ./tmp/packs/locale_es.js 325 bytes {27} [built]
 [487] ./tmp/packs/locale_fa.js 325 bytes {26} [built]
 [488] ./tmp/packs/locale_fi.js 325 bytes {25} [built]
 [489] ./tmp/packs/locale_fr.js 325 bytes {24} [built]
 [490] ./tmp/packs/locale_he.js 325 bytes {23} [built]
 [493] ./tmp/packs/locale_id.js 325 bytes {20} [built]
    + 1044 hidden modules

ERROR in ./app/javascript/packs/public.js
Module not found: Error: Can't resolve 'rails-ujs' in '/home/mastodon/live/app/javascript/packs'
 @ ./app/javascript/packs/public.js 3:0-37

ERROR in ./app/javascript/packs/common.js
Module not found: Error: Can't resolve 'rails-ujs' in '/home/mastodon/live/app/javascript/packs'
 @ ./app/javascript/packs/common.js 1:0-34
Child extract-text-webpack-plugin:
       [0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
       [1] ./~/font-awesome/fonts/fontawesome-webfont.eot 102 bytes {0} [built]
       [2] ./~/font-awesome/fonts/fontawesome-webfont.eot?v=4.7.0 102 bytes {0} [built]
       [3] ./~/font-awesome/fonts/fontawesome-webfont.svg?v=4.7.0 102 bytes {0} [built]
       [4] ./~/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0 102 bytes {0} [built]
       [5] ./~/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 104 bytes {0} [built]
       [6] ./~/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0 103 bytes {0} [built]
       [7] ./~/css-loader?{"minimize":true}!./~/postcss-loader/lib?{"sourceMap":true}!./~/resolve-url-loader!./~/sass-loader/lib/loader.js!./~/font-awesome/css/font-awesome.css 33.2 kB {0} [built]
Child extract-text-webpack-plugin:
       [0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
       [2] ./app/javascript/fonts/montserrat/Montserrat-Regular.woff 102 bytes {0} [built]
       [3] ./app/javascript/fonts/montserrat/Montserrat-Regular.woff2 103 bytes {0} [built]
       [4] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.svg 109 bytes {0} [built]
       [5] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.ttf 109 bytes {0} [built]
       [6] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff 110 bytes {0} [built]
       [7] ./app/javascript/fonts/roboto-mono/robotomono-regular-webfont.woff2 111 bytes {0} [built]
       [8] ./app/javascript/fonts/roboto/roboto-bold-webfont.svg 102 bytes {0} [built]
       [9] ./app/javascript/fonts/roboto/roboto-bold-webfont.ttf 102 bytes {0} [built]
      [10] ./app/javascript/fonts/roboto/roboto-bold-webfont.woff 103 bytes {0} [built]
      [11] ./app/javascript/fonts/roboto/roboto-bold-webfont.woff2 104 bytes {0} [built]
      [12] ./app/javascript/fonts/roboto/roboto-italic-webfont.svg 104 bytes {0} [built]
      [13] ./app/javascript/fonts/roboto/roboto-italic-webfont.ttf 104 bytes {0} [built]
      [14] ./app/javascript/fonts/roboto/roboto-italic-webfont.woff 105 bytes {0} [built]
      [29] ./~/css-loader?{"minimize":true}!./~/postcss-loader/lib?{"sourceMap":true}!./~/resolve-url-loader!./~/sass-loader/lib/loader.js!./app/javascript/styles/application.scss 114 kB {0} [built]
        + 15 hidden modules
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed with exit code 2.

BTW: I added bigdecimal in Gemfile because I can't run without it, don't know if it's expected ...

@BastienDurel

This comment has been minimized.

Copy link
Author

BastienDurel commented Jun 23, 2017

same error with 1.4.5, or 1.4.6

@BastienDurel

This comment has been minimized.

Copy link
Author

BastienDurel commented Jun 29, 2017

I installed rails-ujs with npm to let it be resolved. Why isn't it installed by default ?

@matyapiro31

This comment has been minimized.

Copy link

matyapiro31 commented Sep 6, 2017

rails-ujs is in yarn.lock, so this no more happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment