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

BUG : Command '['/usr/bin/npm', 'bin', '--global']' returned non-zero exit status 1. #337

Closed
icepick4 opened this issue Nov 20, 2022 · 12 comments · Fixed by #346
Closed
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@icepick4
Copy link

I don't know why but when I run my workflow, I got this error :

Screenshot_1

Here is my .yml file :

name: Waka Readme

on:
  schedule:
    # Runs at 12am IST
    - cron: '0 0 * * *'
  workflow_dispatch:
jobs:
  update-readme:
    name: Update Readme with Metrics
    runs-on: ubuntu-latest
    steps:
      - uses: anmol098/waka-readme-stats@master
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          SHOW_PROFILE_VIEWS: false
          SHOW_OS: TRUE
          SHOW_PROJECTS: TRUE
          SHOW_LANGUAGE: TRUE
          SHOW_TIMEZONE: false
          SHOW_EDITORS: false

I looked to see if other people had this problem, but I didn't find anything.
Maybe I missed something about the process.
Thank's for your help

@icepick4 icepick4 added the bug Something isn't working label Nov 20, 2022
@aravindvnair99
Copy link
Collaborator

@icepick4 I'm having same issue since last 12 days as seen here - https://github.com/aravindvnair99/AravindVNair99/commits/main

So you're not the only one. Looks like something has changed in the dependencies.

As per the error message, something is going wrong when we try to save the bar graph here:

chart.save('bar_graph.png')

@icepick4
Copy link
Author

Thank's for your answer !
Okay okay, I thought I did something wrong I am relieved, then I will wait for an update.

@unownone
Copy link

Hey @icepick4 @aravindvnair99 you guys can have a quick fix , in your config set SHOW_LOC_CHART="False" , this should make sure that loc.py isn't invoked not causing the problem .

@aravindvnair99
Copy link
Collaborator

@unownone Yes that's correct. I wanted to find the issue and the solution for the same however. Unfortunately, I haven't had time to look at what's causing the issue. If anyone wants to submit a PR, feel free.

@aravindvnair99 aravindvnair99 added the help wanted Extra attention is needed label Nov 22, 2022
@icepick4
Copy link
Author

@unownone Thank you it works !

@unownone
Copy link

@aravindvnair99 I think the issue most probably is coming from altair or the data that is coming from outside , as it breaks at a subprocess level , so you have to dig pretty down ig? I sat down for a while but gave up :,,,) , generating github personal access tokens are a pain .

Do you think there's a good way to test things ( like printing in a test.md for testing @anmol098 )

@aravindvnair99
Copy link
Collaborator

@unownone generally what I do to test is fork this repository, makes changes in my fork. Set my profile to use my fork to validate and test instead of pointing to this repository and once things look good, I create a pull request.

Unfortunately we don't have a CI system in this repository to test every incoming PR.

MarkenJaden added a commit to MarkenJaden/MarkenJaden that referenced this issue Nov 25, 2022
@pseusys
Copy link
Collaborator

pseusys commented Dec 8, 2022

@aravindvnair99, I've submitted a PR that should solve the issue (however I still get http error 104 localy), could you please check it out?

@aravindvnair99 aravindvnair99 linked a pull request Jan 6, 2023 that will close this issue
aravindvnair99 added a commit that referenced this issue Jan 12, 2023
* NPM update removed [because of breaking changes introduced in NPMv9](altair-viz/altair_saver#113), NPMv8 is provided with container [by default](https://hub.docker.com/r/nikolaik/python-nodejs)

* Set `npm` to not go beyond v9 because of altair-viz/altair_saver#113

v9 has a breaking change for our dependency

Co-authored-by: Aravind Nair <[email protected]>
@aravindvnair99
Copy link
Collaborator

Thanks for the PR @pseusys!

@unownone / @icepick4 I've merged the PR. You can test it out.

@jschaef
Copy link

jschaef commented Jan 19, 2023

stumbled over same error: Command '['/usr/bin/npm', 'bin', '--global']' returned non-zero exit status 1 with npm 9.3.1 (openSUSE Tumbleweed). It turned out that from `altair_saver/savers/_node.py +15:

@functools.lru_cache(2)
def npm_bin(global_: bool) -> str:
    """Locate the npm binary directory."""
    npm = shutil.which("npm")
    if not npm:
        raise ExecutableNotFound("npm")
    cmd = [npm, "bin"]
    if global_:
        cmd.append("--global")
    return check_output_with_stderr(cmd).decode().strip()

We get an error because npm --global returns some help and echo $? shows 1.

I changed above code to just:

@functools.lru_cache(2)
def npm_bin(global_: bool) -> str:
    """Locate the npm binary directory."""
    npm = shutil.which("npm")
    if not npm:
        raise ExecutableNotFound("npm")
    cmd = [npm, "bin"]
    if global_:
        cmd.append("--global")
    cmd.append("--version")
    ^^^^^^^^^^^^^^^^^^^^^^^
    return check_output_with_stderr(cmd).decode().strip()

So npm --global --version is a valid command returning 0. I don't know if this
applies for other distributions also. npm has been installed via:

npm install -g npm@latest
which npm: /usr/local/bin/npm

works also with os specific package installed via:

zypper in npm
which npm: /usr/bin/npm

@mollenhauer
Copy link

My solution is to install all node depencies in my python project directory:

npm init
npm install vega-lite vega-cli canvas
npm install npm@8

And since .venv/bin is already in the PATH i will link npm into it:

ln -sf ../../node_modules/.bin/npm .venv/bin/npm

@pseusys
Copy link
Collaborator

pseusys commented Mar 21, 2023

@mollenhauer the issue was resolved a while ago...

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

Successfully merging a pull request may close this issue.

7 participants