instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.71k stars 2.52k forks source link

Can't resolve 'translations/registration.incomplete_registration_warning' in '/var/canvas/public/javascripts' #1584

Open vtuhtan opened 4 years ago

vtuhtan commented 4 years ago

Summary:

I tried to follow Production Start guide and I'm unable to generate assets.

$ yarn --version
1.10.1
$ node --version
v10.19.0

Steps to reproduce:

  1. Configuration: EC2 instance (Ubuntu 18.04 LTS, t3.large), RDS (PostgreSQL 9.5), S3
  2. Follow Production Start guide
  3. Issue appear at Generate Assets section RAILS_ENV=production bundle exec rake canvas:compile_assets

Expected behavior:

Assets built without error.

Actual behavior:

--> Building PRODUCTION webpack bundles
yarn run v1.10.1
$ NODE_ENV=production gulp rev && NODE_ENV=production NODE_OPTIONS="--max_old_space_size=8192" webpack --color && yarn lint:browser-code
[14:45:18] Using gulpfile /var/canvas/gulpfile.js
[14:45:18] Starting 'rev'...
(node:19828) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[14:45:19] Finished 'rev' after 1.26 s
(node:19843) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
ModuleNotFoundError: Module not found: Error: Can't resolve 'translations/registration.incomplete_registration_warning' in '/var/canvas/public/javascripts'
    at factory.create (/var/canvas/node_modules/webpack/lib/Compilation.js:925:10)
    at factory (/var/canvas/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
    at resolver (/var/canvas/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
    at asyncLib.parallel (/var/canvas/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
    at /var/canvas/node_modules/neo-async/async.js:2830:7
    at /var/canvas/node_modules/neo-async/async.js:6877:13
    at normalResolver.resolve (/var/canvas/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
    at doResolve (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:184:12)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:27:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn42 (<anonymous>:28:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:23:37)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn2 (<anonymous>:16:1)
    at args (/var/canvas/node_modules/enhanced-resolve/lib/forEachBail.js:30:14)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:27:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn43 (<anonymous>:16:1)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:27:1)
    at resolver.doResolve (/var/canvas/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn1 (<anonymous>:16:1)
    at hook.callAsync (/var/canvas/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
    at _fn0 (<anonymous>:15:1)
    at fs.stat (/var/canvas/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:22:13)
    at process.nextTick (/var/canvas/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:73:15)
    at process._tickCallback (internal/process/next_tick.js:61:11)

resolve 'translations/registration.incomplete_registration_warning' in '/var/canvas/public/javascripts'
  Parsed request is a module
  using description file: /var/canvas/package.json (relative path: ./public/javascripts)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /var/canvas/public/javascripts
        using description file: /var/canvas/package.json (relative path: ./public/javascripts)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /var/canvas/package.json (relative path: ./public/javascripts/translations/registration.incomplete_registration_warning)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/public/javascripts/translations/registration.incomplete_registration_warning doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/public/javascripts/translations/registration.incomplete_registration_warning.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/public/javascripts/translations/registration.incomplete_registration_warning.js doesn't exist
            as directory
              /var/canvas/public/javascripts/translations/registration.incomplete_registration_warning doesn't exist
      looking for modules in /var/canvas/gems/plugins
        using description file: /var/canvas/package.json (relative path: ./gems/plugins)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /var/canvas/package.json (relative path: ./gems/plugins/translations/registration.incomplete_registration_warning)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/gems/plugins/translations/registration.incomplete_registration_warning doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/gems/plugins/translations/registration.incomplete_registration_warning.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/gems/plugins/translations/registration.incomplete_registration_warning.js doesn't exist
            as directory
              /var/canvas/gems/plugins/translations/registration.incomplete_registration_warning doesn't exist
      /var/canvas/public/javascripts/node_modules doesn't exist or is not a directory
      /var/canvas/public/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/canvas/node_modules
        using description file: /var/canvas/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /var/canvas/package.json (relative path: ./node_modules/translations/registration.incomplete_registration_warning)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/node_modules/translations/registration.incomplete_registration_warning doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/node_modules/translations/registration.incomplete_registration_warning.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /var/canvas/node_modules/translations/registration.incomplete_registration_warning.js doesn't exist
            as directory
              /var/canvas/node_modules/translations/registration.incomplete_registration_warning doesn't exist
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
rake aborted!
Parallel::UndumpableException: RuntimeError: Error running js:webpack_production:
ABORTING
/var/canvas/lib/tasks/js.rake:50:in `block (2 levels) in <top (required)>'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/var/canvas/lib/tasks/canvas.rake:77:in `block (5 levels) in <top (required)>'
/usr/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
/var/canvas/lib/tasks/canvas.rake:7:in `log_time'
/var/canvas/lib/tasks/canvas.rake:77:in `block (4 levels) in <top (required)>'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/parallel-1.18.0/lib/parallel.rb:506:in `call_with_index'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/parallel-1.18.0/lib/parallel.rb:360:in `block (2 levels) in work_in_threads'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/parallel-1.18.0/lib/parallel.rb:515:in `with_instrumentation'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/parallel-1.18.0/lib/parallel.rb:359:in `block in work_in_threads'
/var/canvas/vendor/bundle/ruby/2.4.0/gems/parallel-1.18.0/lib/parallel.rb:209:in `block (3 levels) in in_threads'
Tasks: TOP => canvas:compile_assets

Additional notes:

I tried to clean install node modules:

$ rm -rfv gems/plugins/*/node_modules
$ yarn install
$ RAILS_ENV=production JS_BUILD_NO_UGLIFY=True bundle exec rake canvas:compile_assets --trace

I'm able to successfully build development environment bundle exec rake canvas:compile_assets

johnford2002 commented 4 years ago

I'm encountering this same issue, and I've yet to figure out how to solve it. I dropped back to Ubuntu 16.05 with the same general package setup, and I encounter the same issue.

johnford2002 commented 4 years ago

Has anyone on the dev team run into this? I've tried using the latest yarn (1.22.0) as well as the yarn version that appears to be in use in the Dockerfile (1.19.1), but neither appears to make a difference in this issue.

I believe the dev compile works because it doesn't actually trigger the translations, but production fails consistently for me.

vtuhtan commented 4 years ago

@johnford2002 Most likely it's permissions issue. I was able to build the app without changing ownership to canvasuser. Hope it helps.