Error: Cannot find module 'libnpx'

I install the frontend according to the following instructions and get the above error message - step: npm init yo @plone/volto.

My system environment is WSL2 with Ubuntu 20.04.

Installing latest LTS version.
Downloading and installing node v16.13.0...
Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz...
###################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v16.13.0 (npm v8.1.0)
Creating default alias: default -> lts/* (-> v16.13.0)

added 1 package, and audited 2 packages in 2s

found 0 vulnerabilities
npm notice
npm notice New patch version of npm available! 8.1.0 -> 8.1.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.3>
npm notice Run `npm install -g npm@8.1.3` to update!
npm notice
Need to install the following packages:
  create-yo
Ok to proceed? (y) y
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'libnpx'
Require stack:
- /home/walter/.nvm/versions/node/v16.13.0/lib/node_modules/npm/noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at resolveFileName (/home/walter/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/home/walter/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:43:9)
    at module.exports (/home/walter/.npm/_npx/695c49aed3c9f0d7/node_modules/resolve-from/index.js:46:47)
    at module.exports (/home/walter/.npm/_npx/695c49aed3c9f0d7/node_modules/import-from/index.js:4:55)
    at Object.<anonymous> (/home/walter/.npm/_npx/695c49aed3c9f0d7/node_modules/create-yo/src/create-yo.js:8:13)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/walter/.nvm/versions/node/v16.13.0/lib/node_modules/npm/noop.js'
  ]
}
npm ERR! code 1
npm ERR! path /home/walter
npm ERR! command failed
npm ERR! command sh -c create-yo "@plone/volto"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/walter/.npm/_logs/2021-11-09T08_38_14_097Z-debug.log

Use the steps here: Bootstrap Volto - Volto Developer Documentation

create-yo based method broke at some point, we have a ticket on that.

Yeah, that's unfortunately a known issue that happens to some users. See Use create-yo trampoline in documentation · Issue #2067 · plone/volto · GitHub

We should be fixing all the trainings at some point, as mentioned in the issue. You can find alternative ways over there.

I tried to follow the instructions - with a few Ubuntu-specific changes, e.g.:

  • .bashrc instead of .bash_profile
  • eval instead of source
walter@jfww-win-nb-18:~$ cd /mnt/d/SoftDevelopment/Projects/docker_images/projects/res_reg_dev/1.0.0
walter@jfww-win-nb-18:/mnt/d/SoftDevelopment/Projects/docker_images/projects/res_reg_dev/1.0.0$ ./run_*_2.sh

Script ./run_install_4_vm_wsl2_2.sh is now running

You can find the run log in the file run_install_4_vm_wsl2_2.log

==============================================================================
Start ./run_install_4_vm_wsl2_2.sh
------------------------------------------------------------------------------
Install a res_reg_dev environment for Ubuntu 20.04 - Step 2.
------------------------------------------------------------------------------
HOST_ENVIRONMENT                  : wsl2
USER                              : walter
------------------------------------------------------------------------------
DATE TIME : 10.11.2021 03:34:28
==============================================================================
Step: Install asdf - part 2
------------------------------------------------------------------------------

Current version of asdf is: v0.8.1-c911f2d

==============================================================================
[sudo] password for walter:
------------------------------------------------------------------------------
Step: Install Python3 - Version 3.9.0
------------------------------------------------------------------------------
Downloading python-build...
Cloning into '/home/walter/.asdf/plugins/python/pyenv'...
python-build 3.9.0 /home/walter/.asdf/installs/python/3.9.0
Downloading Python-3.9.0.tar.xz...
-> https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
Installing Python-3.9.0...
Installed Python-3.9.0 to /home/walter/.asdf/installs/python/3.9.0

------------------------------------------------------------------------------
Step: Install pip
------------------------------------------------------------------------------
2021-11-10 03:36:34 URL:https://bootstrap.pypa.io/get-pip.py [2159352/2159352] -> "get-pip.py" [1]
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
Successfully installed pip-21.3.1
Requirement already satisfied: pip in ./.asdf/installs/python/3.9.0/lib/python3.9/site-packages (from -r /home/walter/res_reg_install/config_python3/requirements.txt (line 1)) (21.3.1)

=============================================================================> Version  Python3:

Current version of Python3: Python 3.9.0

Current version of pip: pip 21.3.1 from /home/walter/.asdf/installs/python/3.9.0/lib/python3.9/site-packages/pip (python 3.9)

==============================================================================
--------------------------------------------------------------------------
Step: Bootstrap Volto - Volto Developer Documentation (https://docs.voltocms.com/getting-started/install/#install-volto)
--------------------------------------------------------------------------
next cmd=export NVM_DIR="/home/walter/.nvm"
next cmd=[ -s "/home/walter/.nvm/nvm.sh" ] && \. "/home/walter/.nvm/nvm.sh"
next cmd=[ -s "/home/walter/.nvm/bash_completion" ] && \. "/home/walter/.nvm/bash_completion"
next cmd=nvm --version
0.34.0
next cmd=nvm install 16
v16.13.0 is already installed.
Now using node v16.13.0 (npm v8.1.0)
next cmd=node -v
v16.13.0
next cmd=rm -rf ~/.yarn
next cmd=curl -o- -L https://yarnpkg.com/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    53  100    53    0     0    350      0 --:--:-- --:--:-- --:--:--   350
100  7152  100  7152    0     0  21285      0 --:--:-- --:--:-- --:--:-- 21285
Installing Yarn!
> Downloading tarball...

[1/2]: https://yarnpkg.com/latest.tar.gz --> /tmp/yarn.tar.gz.vwQa0tQSRx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    56  100    56    0     0    462      0 --:--:-- --:--:-- --:--:--   462
100    95  100    95    0     0    420      0 --:--:-- --:--:-- --:--:--   420
100   626  100   626    0     0   1830      0 --:--:-- --:--:-- --:--:--  1830
100 1216k  100 1216k    0     0  1733k      0 --:--:-- --:--:-- --:--:-- 1733k

[2/2]: https://yarnpkg.com/latest.tar.gz.asc --> /tmp/yarn.tar.gz.vwQa0tQSRx.asc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    60  100    60    0     0   1578      0 --:--:-- --:--:-- --:--:--  1578
100    99  100    99    0     0   1736      0 --:--:-- --:--:-- --:--:--  1736
100   661  100   661    0     0   7511      0 --:--:-- --:--:-- --:--:--  7511
100  1028  100  1028    0     0   1525      0 --:--:-- --:--:-- --:--:--  2824
> Verifying integrity...
gpg: Signature made Thu 30 Sep 2021 02:14:59 AM CEST
gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
     Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
> GPG signature looks good
> Extracting to ~/.yarn...
> Adding to $PATH...
> Successfully installed Yarn 1.22.15! Please open another terminal where the `yarn` command will now be available.
next cmd=eval "
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# ----------------------------------------------------------------------------
# Environment res_reg_dev for Ubuntu 20.04 - Start
# ----------------------------------------------------------------------------

export DEBIAN_FRONTEND=noninteractive
export HOST_ENVIRONMENT=wsl2
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LOCALE=en_US.UTF-8

export VERSION_RES_REG_DEV=1.0.0

export VERSION_DOS2UNIX=7.4.2
export VERSION_NVM=0.34.0
export VERSION_PLONE_1_2=5.2
export VERSION_PLONE_3=5
export VERSION_PLONE_PYTHON3_1_2=3.9
export VERSION_PLONE_PYTHON3_3=0

alias python=python3
alias vi=vim

. /home/walter/.bashrc.stefan

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/d/Software/Elixir/bin:/mnt/d/Software/erl-24.1/bin:/mnt/d/Software/gradle-7.2/bin:/mnt/d/Software/jdk-17/bin:/mnt/d/Software/Julia-1.6.3/bin:/mnt/d/Software/kotlinc/bin:/mnt/d/Software/Python39:/mnt/d/Software/Python39/Scripts:/mnt/d/Software/rebar3:/mnt/d/Software/GnuWin32/bin:/mnt/d/Software/instantclient_19_12:/mnt/d/Software/TDM-GCC-64/bin:/mnt/d/Software/Go/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/walte/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/walte/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/walte/go/bin:/snap/bin":/home/walter/.asdf/bin:/home/walter/.asdf/shims:
export PATH_ORIG="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/d/Software/Elixir/bin:/mnt/d/Software/erl-24.1/bin:/mnt/d/Software/gradle-7.2/bin:/mnt/d/Software/jdk-17/bin:/mnt/d/Software/Julia-1.6.3/bin:/mnt/d/Software/kotlinc/bin:/mnt/d/Software/Python39:/mnt/d/Software/Python39/Scripts:/mnt/d/Software/rebar3:/mnt/d/Software/GnuWin32/bin:/mnt/d/Software/instantclient_19_12:/mnt/d/Software/TDM-GCC-64/bin:/mnt/d/Software/Go/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/walte/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/walte/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/walte/go/bin:/snap/bin"

. /home/walter/.asdf/asdf.sh
. /home/walter/.asdf/completions/asdf.bash

# ----------------------------------------------------------------------------
# Environment res_reg_dev for Ubuntu 20.04 - End
# ----------------------------------------------------------------------------

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH""
next cmd=yarn -v
1.22.15
next cmd=docker ps
CONTAINER ID   IMAGE                    COMMAND        CREATED      STATUS          PORTS                                                      NAMES
14ba3033c41d   portainer/portainer-ce   "/portainer"   2 days ago   Up 53 minutes   0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp, 9443/tcp   portainer
next cmd=export RES_REG_VERSION_PLONE=5.2.5-python39
next cmd=docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="plone.volto" -e ZCML="plone.volto.cors" -e PROFILES="plone.volto:default-homepage" plone:5.2.5-python39
Unable to find image 'plone:5.2.5-python39' locally
5.2.5-python39: Pulling from library/plone
b380bbd43752: Pulling fs layer
14063a2781d6: Pulling fs layer
5a63271f8164: Pulling fs layer
8bcf4fd3160a: Pulling fs layer
31aed500758c: Pulling fs layer
343afafe42b8: Pulling fs layer
f437b6786239: Pulling fs layer
379f16242025: Pulling fs layer
3043cc593590: Pulling fs layer
f437b6786239: Waiting
8bcf4fd3160a: Waiting
379f16242025: Waiting
3043cc593590: Waiting
31aed500758c: Waiting
343afafe42b8: Waiting
14063a2781d6: Download complete
5a63271f8164: Verifying Checksum
5a63271f8164: Download complete
b380bbd43752: Download complete
b380bbd43752: Pull complete
14063a2781d6: Pull complete
5a63271f8164: Pull complete
8bcf4fd3160a: Verifying Checksum
8bcf4fd3160a: Download complete
343afafe42b8: Verifying Checksum
343afafe42b8: Download complete
8bcf4fd3160a: Pull complete
31aed500758c: Verifying Checksum
31aed500758c: Pull complete
343afafe42b8: Pull complete
3043cc593590: Verifying Checksum
3043cc593590: Download complete
f437b6786239: Verifying Checksum
f437b6786239: Download complete
f437b6786239: Pull complete
379f16242025: Verifying Checksum
379f16242025: Download complete
379f16242025: Pull complete
3043cc593590: Pull complete
Digest: sha256:9d09aed083a0cdf38cd026ae01fe0ca69f089a3813ea4646325e48a0b79e2910
Status: Downloaded newer image for plone:5.2.5-python39
Uninstalling plonesite.
Uninstalling mrbob.
Uninstalling zeo.
Uninstalling precompiler.
Uninstalling unifiedinstaller.
Uninstalling zopepy.
Uninstalling zopescripts.
Uninstalling repozo.
Uninstalling zeoserver.
Uninstalling instance.
Unused options for buildout: 'deprecation-warnings' 'effective-user'.
Installing instance.
Getting distribution for 'plone.volto'.
Got plone.volto 3.1.0a5.
Version and requirements information containing plone.restapi:
  [versions] constraint on plone.restapi: 8.12.1
  Requirement of plone.volto: plone.restapi>=8.13.0
  Requirement of Plone==5.2.5: plone.restapi
While:
  Installing instance.
Error: The requirement ('plone.restapi>=8.13.0') is not allowed by your [versions] constraint (8.12.1)
walter@jfww-win-nb-18:/mnt/d/SoftDevelopment/Projects/docker_images/projects/res_reg_dev/1.0.0$