Extension develop environment init failed

Here is my bug logs. I’m using py3.12, node18.18.2 on windows.

Obtaining file:///D:/A_Code_Exercise/jupyterext_test/jupyterlab-extension-examples/hello-world
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [39 lines of output]
      INFO:hatch_jupyter_builder.utils:Running jupyter-builder
      INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder
      INFO:hatch_jupyter_builder.utils:With kwargs: {'build_cmd': 'install:extension', 'npm': ['jlpm'], 'source_dir': 'src', 'build_dir': 'jupyterlab_examples_hello_world/labextension'}
      INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm.  This may take a while...
      INFO:hatch_jupyter_builder.utils:> C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\overlay\Scripts\jlpm.EXE install   
      Traceback (most recent call last):
        File "E:\Software\Anaconda\envs\jupyterlab-extension-examples\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 167, in prepare_metadata_for_build_editable
          hook = backend.prepare_metadata_for_build_editable
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "E:\Software\Anaconda\envs\jupyterlab-extension-examples\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "E:\Software\Anaconda\envs\jupyterlab-extension-examples\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "E:\Software\Anaconda\envs\jupyterlab-extension-examples\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\overlay\Lib\site-packages\hatchling\build.py", line 82, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\overlay\Lib\site-packages\hatchling\builders\plugin\interface.py", line 147, in build
          build_hook.initialize(version, build_data)
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\normal\Lib\site-packages\hatch_jupyter_builder\plugin.py", line 87, in initialize
          raise e
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\normal\Lib\site-packages\hatch_jupyter_builder\plugin.py", line 82, in initialize
          build_func(self.target_name, version, **build_kwargs)
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\normal\Lib\site-packages\hatch_jupyter_builder\utils.py", line 113, in npm_builder
          run([*npm_cmd, "install"], cwd=str(abs_path))
        File "C:\Users\XXXX\AppData\Local\Temp\pip-build-env-wx5j2k3e\normal\Lib\site-packages\hatch_jupyter_builder\utils.py", line 229, in run
          return subprocess.check_call(cmd, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "E:\Software\Anaconda\envs\jupyterlab-extension-examples\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['C:\\Users\\XXXX\\AppData\\Local\\Temp\\pip-build-env-wx5j2k3e\\overlay\\Scripts\\jlpm.EXE', 'install']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I follow steps (from turtorial jupyterlab/extension-examples) below and meet this bug

# clone the repository
git clone https://github.com/jupyterlab/extension-examples.git jupyterlab-extension-examples

# go to the extension examples folder
cd jupyterlab-extension-examples

# create a new environment
conda env create

# activate the environment
conda activate jupyterlab-extension-examples

# go to the hello world example
cd hello-world

# install the extension in editable mode
python -m pip install -e .

I tried py3.11, py3.10,py3.8, but all meet the same problem.

By the way, I successfully built my environment and developed my extension a few months ago. After reinstalling anaconda, I found that command failed.

I’ve been stuck for days and I don’t know why

Note: discussion in python -m pip install -e error · Issue #261 · jupyterlab/extension-examples · GitHub