Tryton 4.2 Running in the Browser - SAO Challenges

Dear All,
I haven’t used trytond’s web client for a while, basically because it was too bulky to install, and in its early days the installation procedure tended to be a bit wobbly… certainly on FreeBSD.

Now, with Werkzeug in place and version 4.2, I want to give it another spin (having used the GTK client for years and coming from version 3.8). While the configuration file got a lot easier, as JSON and XML-RPC have gone overboard, it is not immediately clear from any documentation within the trytond context that SAO is actually still required. This should be made clearer.

OK, off to SAO. After installing node v.4 and mpn v.2 (higher version disagree with “npm install”, if it is run from within the SAO folder), “npm install” complains about missing PhantomJS v.2.1.14 as follows:
----------%<----------
55934 verbose rebuildBundles bower@1.8.0
55935 silly gentlyRm /home/trytond_erp_caocuero/www/node_modules/.bin/bower is being purged
55936 verbose gentlyRm don’t care about contents; nuking /home/trytond_erp_caocuero/www/node_modules/.bin/bower
55937 info install bower@1.8.0
55938 info postinstall bower@1.8.0
55939 verbose unlock done using /root/.npm/_locks/bower-f44ff0da2d30569e.lock for /home/trytond_erp_caocuero/www/node_modules/bower
55940 verbose stack Error: phantomjs-prebuilt@2.1.14 install: node install.js
55940 verbose stack Exit status 1
55940 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
55940 verbose stack at emitTwo (events.js:87:13)
55940 verbose stack at EventEmitter.emit (events.js:172:7)
55940 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
55940 verbose stack at emitTwo (events.js:87:13)
55940 verbose stack at ChildProcess.emit (events.js:172:7)
55940 verbose stack at maybeClose (internal/child_process.js:854:16)
55940 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
55941 verbose pkgid phantomjs-prebuilt@2.1.14
55942 verbose cwd /home/trytond_erp_caocuero/www
55943 error FreeBSD 10.3-RELEASE-p11
55944 error argv “/usr/local/bin/node” “/usr/local/bin/npm” “install”
55945 error node v4.7.2
55946 error npm v2.15.11
55947 error code ELIFECYCLE
55948 error phantomjs-prebuilt@2.1.14 install: node install.js
55948 error Exit status 1
55949 error Failed at the phantomjs-prebuilt@2.1.14 install script ‘node install.js’.
55949 error This is most likely a problem with the phantomjs-prebuilt package,
55949 error not with npm itself.
55949 error Tell the author that this fails on your system:
55949 error node install.js
55949 error You can get information on how to open an issue for this project with:
55949 error npm bugs phantomjs-prebuilt
55949 error Or if that isn’t available, you can get their info via:
55949 error
55949 error npm owner ls phantomjs-prebuilt
55949 error There is likely additional logging output above.
55950 verbose exit [ 1, true ]
55951 verbose unbuild node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs-prebuilt
55952 info preuninstall phantomjs-prebuilt@2.1.14
55953 info uninstall phantomjs-prebuilt@2.1.14
55954 verbose unbuild rmStuff phantomjs-prebuilt@2.1.14 from /home/trytond_erp_caocuero/www/node_modules
55955 verbose unbuild rmStuff in /home/trytond_erp_caocuero/www/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules
55956 silly gentlyRm /home/trytond_erp_caocuero/www/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/.bin/phantomjs is being gently removed
----------%<----------
The requried version of PhantomJS is very recent, and not available via FreeBSD ports. It is also huge, nor is it mentioned in the ReadMe that comes with SAO. What is missing here?
Thanks for your help.
Chris

Using a different version of Node (v.7) and NPM (v.4), gain inside a FreeBSD jail, provides a different failure: After issuing npm install, the process gets stuck forever at:
----------------------%<-------------------------
$ npm install
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use ‘npm ls graceful-fs’ to find it in the tree.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
[ …] - extract:lodash: sill gunzTarPerm extractEntry node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js
----------------------%<-------------------------
Seeing npm stuck is always a bad sign, as it is un-killable and need a restart of the server.
The whole process bears no relationship to the seemingly simple process in the SAO Readme. From the documentation, SAO may not yet been tested on all too many platforms.
Any thoughts?
Chris

The requirements are defined in package.json which is the standard for npm.
The current version does not make differences between the development and the production installation but issue6176 will do it.

I guess this should be reported to the npm project.

Thanks a lot, Cédric. Sure, package.json defines the requirements. There is a well-known bug with NPM and PhantomJS on FreeBSD, because NPM happily installs the MacOS version of PhantomJS on FreeBSD, which does not work. Of course this is an NPM Problem, but has not been fixed for some time, as it seems.
The best way would indeed be to amend package.json and take out the development requirements, as suggested in issue6176. Do you already have a quick 'n dirty list what can be removed from the existing package.json file, in order to create a production installation, only?
The best strategy to solve NPM issues at present seems to avoid them ;-).
Bests and thanks!
Chris

See the proposal on issue6176.

In reply to msg31280:
The post installation script from package.json was certainly not run (should appear in the log).
So you have to run bower install before launching grunt.

Dear All,
The following works, if run as user running trytond:

cd [trytond www directory]
npm install --production
./node_modules/bower/bin/bower install
./node_modules/.bin/grunt

If you (really) want to install as root, do:

npm install --production
./node_modules/bower/bin/bower install --allow-root
./node_modules/.bin/grunt

and adjust permissions:

chown -R [trytond user]:www /home/${INSTANCE}/sao
chmod -R o-rwx /home/${INSTANCE}/sao

Adjust the [web] stanza in your trytond.conf file accordingly.

Thanks a lot, indeed!

Chris