Error encountered when installing Plone 6.0.0.rc2 (and rc1)

I have encountered an error when installing Plone 6 rc2 (and rc1) from packages. Note, I'm using a machine running Ubuntu 22.04. Here is a copy of the log file:

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/yo
npm ERR! dest /usr/lib/node_modules/.yo-njbBMV8p
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/yo' -> '/usr/lib/node_modules/.yo-njbBMV8p'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/lib/node_modules/yo' -> '/usr/lib/node_modules/.yo-njbBMV8p'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/lib/node_modules/yo',
npm ERR!   dest: '/usr/lib/node_modules/.yo-njbBMV8p'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

Also note that if I run the script as root, I get a different error, to wit:

Running sanity checks
  - Python: ✓
  - Node: ✓
  - yo: ✓
  - Docker: ✓
  - git: ✓

Summary:
  - Plone version: 6.0.0rc2
  - Volto version: 16.3.0
  - Volto Generator version: 6.1.2
  - Output folder: /root/plone6/firm

Frontend codebase:
 - Installing @plone/generator-volto@6.1.2
 - Generate frontend application with @plone/volto 16.3.0
Traceback (most recent call last):
  File "/tmp/tmp2ao8b_6c.py", line 167, in <module>
    main()
  File "/tmp/tmp2ao8b_6c.py", line 144, in main
    prepare_frontend(
  File "/tmp/tmp2ao8b_6c.py", line 116, in prepare_frontend
    with open(cfg, "r") as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/root/plone6/firm/frontend/src/config.js'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

They sound like minor issues, but they ought to be ironed out before 6.0.0 is released.

The OS does not let you change things in /usr/lib/node_modules/. I think you're using npm installing global modules, while your project should install them locally. Maybe the script found yo already installed but globally and tried to upgrade it, failing.

Try to force a local installation but I don't know how.

I really like "The Script" but the music band. :wink: . Which script are you referring to that does the installation. ? the cookiecutter template?

For both python and node/javascript installations it is advised to use virtualenv (python) and nvm (node) or similar tools to create a language runtime environment that doesn't directly use the system installed version of the programming language.

This also isolates from the issue you now have where the 'yo' module has already been installed in the system node environment and where another application wants to update it.

2 Likes

Yes, it was the cookiecutter template. Sadly, using virtualenv didn't help me. Got the same error messages (for both a regular user and root). The problem is yeoman. It looks like cookiecutter is reinstalling yeoman during the setup (even though it was already installed). However, on my system at least, you have to install yeoman as root (e.g., sudo npm install -g yo) in order for that installation to complete error-free. Incidentally, yo --version returns 4.3.1 on my system.

Maybe it's possible for the cookiecutter script to install yeoman locally in a temporary folder instead of globally. I think that would avoid this issue as well as being safer and less surprising.

virtualenv will indeed not help you with the ‘yo’ module, because yo is a javascript module. nvm is the Node Version Manager for javascript. Virtualenv is for Python.

Unfortunately every language has the same
challenges (modules, package management, versioning) bit different tooling and naming.

Previous trainings where yo was necessary used ‘npx yo’ to have yo installed temporarily just to run the scaffolding.

But this also didn’t always work for training participants, they would get an error that a library needed for npx could not be found, or other bootstrap issues

We tried to make lists of which combinations of node (12,14,16), npm (6,7,8) and OS but it was semi random and a minority of users, but very persistent.