Open link in a new tab

Content

Expand project menu

assets:precompile fails

I have another issue. I try to precompile all assets but I get always this error.

RAILS_ENV=production rake assets:precompile --trace


** Invoke assets:precompile (first_time)
** Invoke assets:compile_environment (first_time)
** Invoke assets:prepare_op (first_time)
** Invoke assets:angular (first_time)
** Execute assets:angular
Linking frontend plugins
** Invoke openproject:plugins:register_frontend (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute openproject:plugins:register_frontend
Cleaning linked target directory /opt/openproject/frontend/src/app/modules/plugins/linked
Linking frontend of OpenProject plugin openproject-avatars to /opt/openproject/frontend/src/app/modules/plugins/linked/openproject-avatars.
Linking frontend of OpenProject plugin openproject-costs to /opt/openproject/frontend/src/app/modules/plugins/linked/openproject-costs.
Linking frontend of OpenProject plugin openproject-documents to /opt/openproject/frontend/src/app/modules/plugins/linked/openproject-documents.
Regenerating frontend plugin registry /opt/openproject/frontend/src/app/modules/plugins/linked-plugins.module.ts.
Building angular frontend
npm run build
rake aborted!
Failed to compile angular frontend: 127
/opt/openproject/lib/tasks/assets.rake:66:in `block (4 levels) in <top (required)>'
/usr/lib/ruby/vendor_ruby/rake/file_utils.rb:57:in `sh'
/opt/openproject/lib/tasks/assets.rake:65:in `block (3 levels) in <top (required)>'
/opt/openproject/lib/tasks/assets.rake:64:in `chdir'
/opt/openproject/lib/tasks/assets.rake:64:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/vendor_ruby/rake/task.rb:271:in `block in execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:271:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:271:in `execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:213:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:193:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:237:in `block in invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:212:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:193:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:237:in `block in invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:212:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:193:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:237:in `block in invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `invoke_prerequisites'
/usr/lib/ruby/vendor_ruby/rake/task.rb:212:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:193:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:182:in `invoke'
/usr/lib/ruby/vendor_ruby/rake/application.rb:160:in `invoke_task'
/usr/lib/ruby/vendor_ruby/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:116:in `each'
/usr/lib/ruby/vendor_ruby/rake/application.rb:116:in `block in top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:125:in `run_with_threads'
/usr/lib/ruby/vendor_ruby/rake/application.rb:110:in `top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:83:in `block in run'
/usr/lib/ruby/vendor_ruby/rake/application.rb:186:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:80:in `run'
/usr/bin/rake:27:in `<main>'
Tasks: TOP => assets:precompile => assets:compile_environment => assets:prepare_op => assets:angular
Message actions

Hi Markus,

what is output when you manually run cd frontend && npm run build ?

I assume that you do not have the npm frontend dependencies installed, or some other error happens during compilation of frontend assets (not enough RAM, possibly)

Best

Oliver

Message actions

With that command I found many packages which were missing. However now I have another issue and I don't know why. It tells me that I have to install angulare/core. That I did and also the dependeny rxjs and zone.js but still doesn't work.

/usr/local/lib
├── @angular/core@8.2.13
├── UNMET PEER DEPENDENCY rxjs@^6.4.0
└── UNMET PEER DEPENDENCY zone.js@~0.9.1

npm WARN @angular/core@8.2.13 requires a peer of rxjs@^6.4.0 but none was installed.
npm WARN @angular/core@8.2.13 requires a peer of zone.js@~0.9.1 but none was installed.
root@myserver:~# npm install -g rxjs
/usr/local/lib
└── rxjs@6.5.3

root@myserver:~# npm install -g zone.js
/usr/local/lib
└── zone.js@0.10.2

openproject@myserver:/opt/openproject$ cd frontend && npm run build

> openproject-frontend@0.1.0 prebuild /opt/openproject/frontend
> ./scripts/link_plugin_placeholder.js


> openproject-frontend@0.1.0 build /opt/openproject/frontend
> ng build --prod

You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! openproject-frontend@0.1.0 build: `ng build --prod`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the openproject-frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/openproject/.npm/_logs/2019-11-05T18_55_08_598Z-debug.log
Message actions

Hi Markus,

let's make one step back. Why do you need to run assets:precompile?

  • Do you have a packaged installation? In this case, the angular frontend has been removed deliberately as all assets are correctly compiled already. You will only need to install them again if you have a custom plugin that uses assets and requires compilation. You will likely not need it nor call to assets:precompile

Best

Oliver

Message actions

My problem was that I couldn't see any pictures when I openend the webpage.