Skip to content

The build-npm fails if package consists of only private sub-packages #529

@yacchin1205

Description

@yacchin1205

Description

The build-npm fails if package consists of only private sub-packages (packages defined in workspaces, for example: https://github.com/yacchin1205/CS-jupyterlab-grdm/tree/feature/jupyter-releaser-bug-2023-10-10 ). The error is as follows.

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-releaser", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/cli.py", line 122, in invoke
    super().invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/cli.py", line 491, in build_npm
    npm.build_dist(package, dist_dir)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/npm.py", line 51, in build_dist
    util.run(f"npm pack {' '.join(paths)}", cwd=dest, quiet=True)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/util.py", line 94, in run
    raise e
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/util.py", line 86, in run
    process = tee(cmd, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/tee.py", line 159, in run
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command 'npm pack ' returned non-zero exit status 254.

When npm.build_dist finds workspaces in package.json, it will try to build those packages as well. However, if they were all private, the contents of the paths variable would be empty and npm pack (without specific package.json(s)) would be executed.
As a result, npm looks for package.json under the dest directory, and this error is assumed to be the result.

Reproduce

  1. Git clone feature/jupyter-releaser-bug-2023-10-10 branch of https://github.com/yacchin1205/CS-jupyterlab-grdm
  2. Execute jupyter-releaser prep-git
  3. Execute jupyter-releaser build-npm
  4. See error output

Full output is below:

root@ad7e88512c12:/tmp/releaser/CS-jupyterlab-grdm# pip3 list installed | grep jupyter_releaser
jupyter_releaser          1.2.1
root@ad7e88512c12:/tmp/releaser# git clone -b feature/jupyter-releaser-bug-2023-10-10 https://github.com/yacchin1205/CS-jupyterlab-grdm.git
root@ad7e88512c12:/tmp/releaser/CS-jupyterlab-grdm# jupyter-releaser prep-git
... Successful ...
root@ad7e88512c12:/tmp/releaser/CS-jupyterlab-grdm# jupyter-releaser build-npm
jupyter-releaser configuration loaded from pyproject.toml.
...
stderr:
 npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /tmp/releaser/CS-jupyterlab-grdm/.jupyter_releaser_checkout/dist/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/releaser/CS-jupyterlab-grdm/.jupyter_releaser_checkout/dist/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-10-10T10_10_55_511Z-debug-0.log 


Traceback (most recent call last):
  File "/usr/local/bin/jupyter-releaser", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/cli.py", line 122, in invoke
    super().invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/cli.py", line 491, in build_npm
    npm.build_dist(package, dist_dir)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/npm.py", line 51, in build_dist
    util.run(f"npm pack {' '.join(paths)}", cwd=dest, quiet=True)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/util.py", line 94, in run
    raise e
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/util.py", line 86, in run
    process = tee(cmd, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/jupyter_releaser/tee.py", line 159, in run
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command 'npm pack ' returned non-zero exit status 254.

Expected behavior

The subpackages(in the above example:. ui-tests) are not built and complete without printing errors.

Context

  • Operating System and version: Ubuntu 22.04.3
  • Browser and version: None
  • Jupyter Server version:
    • jupyterlab 4.0.6
    • jupyterlab-pygments 0.2.2
    • jupyterlab_server 2.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions