Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yacchin1205 opened this issue Oct 10, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@yacchin1205
Copy link

yacchin1205 commented Oct 10, 2023

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
@yacchin1205 yacchin1205 added the bug Something isn't working label Oct 10, 2023
@welcome
Copy link

welcome bot commented Oct 10, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@yacchin1205
Copy link
Author

Duplicated with PR #522 . Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant