jupyterlab / extension-cookiecutter-ts

A cookiecutter recipe for JupyterLab extensions in Typescript
BSD 3-Clause "New" or "Revised" License
179 stars 88 forks source link

Invalid Regular Expression in webpack #309

Closed jwindgassen closed 1 year ago

jwindgassen commented 1 year ago

Description

When I create an extension using this template and try to install for development, the build fails due to an SyntaxError: Invalid regular expression: Invalid property name in character class in the webpack npm package. I found this issue (jupyterlab/jupyterlab#10487), which already mentions the problem and suggests it has to do with ICU and Node. I tried the build with the conda nodejs package where I do not know what compiler option it exactly uses, but I would expect it to work by default.

The error occurs either during pip install -e ".[Test]" or jlpm build

I also tried to build the extension on our HPC system, where I encountered the same error, but in a different webpack file.

Reproduce

  1. Create a server extension from this template with the default values
  2. Execute the commands from the Development install section in the README.md

Context

Command Line Output
> jlpm build
yarn run v1.21.1
$ jlpm build:lib && jlpm build:labextension:dev
$ tsc --sourceMap
$ jupyter labextension build --development True .
Building extension in .
/home/jonathan/myextension/node_modules/webpack/lib/RuntimeTemplate.js:64
        trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) ||
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Invalid regular expression: /^[_\p{L}][_0-9\p{L}]*$/: Invalid property name in character class
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1176:20)
    at Module._compile (node:internal/modules/cjs/loader:1218:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object. (/home/jonathan/myextension/node_modules/webpack/lib/Compilation.js:53:25)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)

Node.js v18.15.0
An error occurred.
subprocess.CalledProcessError: Command '['node', '/home/jonathan/myextension/node_modules/@jupyterlab/builder/lib/build-labextension.js', '--core-path', '/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/staging', '/home/jonathan/myextension', '--development']' returned non-zero exit status 1.
See the log file for details:  /tmp/jupyterlab-debug-j5o4_vxt.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Log File
Building extension in .
Traceback (most recent call last):

  File "/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/labextensions.py", line 144, in start
    ans = self.run_task()

  File "/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/labextensions.py", line 260, in run_task
    build_labextension(

  File "/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/federated_labextensions.py", line 215, in build_labextension
    subprocess.check_call(arguments, cwd=ext_path)

  File "/home/jonathan/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['node', '/home/jonathan/myextension/node_modules/@jupyterlab/builder/lib/build-labextension.js', '--core-path', '/home/jonathan/anaconda3/lib/python3.9/site-packages/jupyterlab/staging', '/home/jonathan/myextension', '--development']' returned non-zero exit status 1.

Exiting application: lab