Error running "plone-compile-resources" from cli

Hi,

I have plone 5.1.2 and I've run buildout as described in the resourceregistry docs, under compiling-bundles.

Buildout completes fine, but when I run

./bin/plone-compile-resources --site-id=myplonesite --bundle=mybundle

I get

ImportError: No module named staticresources

Any idea how to get it to run properly?
Thanks

Did you include plone.staticresources in the compile section of your buildout?

Something like this:

[compileresources]
recipe = zc.recipe.egg
eggs =
    Products.CMFPlone
    plone.staticresources
    ${instance:eggs}
scripts =
    plone-compile-resources

plone.staticresources was introduced in Plone 5.2. Check your buildout, there must be some confusion in the versions.

Thanks, I'm now trying to upgrade to 5.2.1 :wink:

I've upgraded to 5.2.1 and now get a different error:

bin/plone-compile-resources --site-id=myplonesite --bundle=mybundle

File "/home/deploycms/newplone/buildout-cache/eggs/zc.lockfile-2.0-py2.7.egg/zc/lockfile/init.py", line 90, in init
_lock_file(fp)
File "/home/deploycms/newplone/buildout-cache/eggs/zc.lockfile-2.0-py2.7.egg/zc/lockfile/init.py", line 61, in _lock_file
raise LockError("Couldn't lock %r" % file.name)
zc.lockfile.LockError: Couldn't lock u'/home/deploycms/newplone/comet/var/filestorage/Data.fs.lock'
Traceback (most recent call last):
File "bin/plone-compile-resources", line 292, in
sys.exit(plone.staticresources._scripts.compile_resources.main())
File "/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/compile_resources.py", line 148, in main
base_path, args.instance, args.site_id, args.compile_dir
File "/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/compile_resources.py", line 57, in generate_gruntfile
subprocess.check_call(cmd, env=os.environ)
File "/home/deploycms/newplone/Python-2.7/lib/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/deploycms/newplone/comet/bin/instance', 'run', '/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/_generate_gruntfile.py']' returned non-zero exit status 1

is this a permissions issue?

Is your site myplonesite running while you try to compile the bundle?
bin/plone-compile-resourcesstarts your Plone site, if it's already running, it can't do that. (if you use a zeoserver/zeoclient setup, than you can connect multiple with zeoclients)

So, I was using the wrong site-id.

I've updated, and now I'm getting

bin/plone-compile-resources --site-id=COMET --bundle=mybundle
Setup npm env
Running command: npm install
audited 1339 packages in 8.274s

3 packages are looking for funding
run npm fund for details

found 9 vulnerabilities (3 low, 4 moderate, 2 high)
run npm audit fix to fix them, or npm audit for details
Running command: /home/deploycms/newplone/comet/bin/instance run /home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/_generate_gruntfile.py
No handlers could be found for logger "Init"
Using site id: COMET
Target compile path: fetch from bundles
Traceback (most recent call last):
File "/home/deploycms/newplone/comet/parts/instance/bin/interpreter", line 302, in
exec(_val)
File "", line 1, in
File "/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/_generate_gruntfile.py", line 267, in
portal.unrestrictedTraverse(script.url)
File "/home/deploycms/newplone/buildout-cache/eggs/Zope-4.1.3-py2.7.egg/OFS/Traversable.py", line 350, in unrestrictedTraverse
raise e
KeyError: 'https:'
Traceback (most recent call last):
File "bin/plone-compile-resources", line 292, in
sys.exit(plone.staticresources._scripts.compile_resources.main())
File "/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/compile_resources.py", line 148, in main
base_path, args.instance, args.site_id, args.compile_dir
File "/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/compile_resources.py", line 57, in generate_gruntfile
subprocess.check_call(cmd, env=os.environ)
File "/home/deploycms/newplone/Python-2.7/lib/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/deploycms/newplone/comet/bin/instance', 'run', '/home/deploycms/newplone/buildout-cache/eggs/plone.staticresources-1.2.1-py2.7.egg/plone/staticresources/_scripts/_generate_gruntfile.py']' returned non-zero exit status 1

Plone Foundation Code of Conduct