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

sh: npm: not found error.... #3475

Closed
MYeager1967 opened this issue Dec 7, 2023 · 10 comments
Closed

sh: npm: not found error.... #3475

MYeager1967 opened this issue Dec 7, 2023 · 10 comments
Assignees
Labels
question Further information is requested

Comments

@MYeager1967
Copy link

I updated the zwavejs/zwavejs2mqtt docker image today to the latest and began getting nothing but the error listed in the subject. I rolled back to the 9.3.1 tag and everything is fine. I just saw that zwavejs2mqtt has been renamed to zwave-js-ui so here I am.

I'm running on an Intel i5 processor running Alpine Linux and Docker. Everything was fine until I pulled whatever the latest is. 9.4.1 didn't work either so I went with 9.3.1. Guessing it's something I need to do, but so far I haven't figured out what...

@MYeager1967 MYeager1967 added the question Further information is requested label Dec 7, 2023
@robertsLando
Copy link
Member

Could you paste here the full error log you see in console?

That's strange as many other users already updated to latest without any problem

@MYeager1967
Copy link
Author

That's all that was in the log unless I need to be pulling something else. I've rarely had any issues with upgrading anything as Docker is self contained, which is why this one stumps me. If it were a common problem, it would be posted everywhere....

@robertsLando
Copy link
Member

Post at least a screenshot of the command you lunch+the output

@MYeager1967
Copy link
Author

I'll post the relevant service from the docker-compose file and the log when I get back home....

@robertsLando
Copy link
Member

I would also try to pull master tag instead of latest to see if something changes

@MYeager1967
Copy link
Author

MYeager1967 commented Dec 10, 2023

Here's the docker-compose for the service.

    container_name: zwave-js-ui
#    image: zwavejs/zwave-js-ui:latest
    image: zwavejs/zwavejs2mqtt:9.3.1
    restart: always
    tty: true
    stop_signal: SIGINT
    devices:
      - /dev/ttyACM0
    environment:
      - TZ=America/New_York
      - AUTOHEAL_CONTAINER_LABEL=true
    volumes:
      - /home/Mike/docker/zwavejs2mqtt/store:/usr/src/app/store
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8091:8091"
      - "3000:3000"
    command: sh -c "apk --no-cache add curl & npm run start"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8091"]
      interval: 30s
      timeout: 5s
      retries: 3

With the image that's commented out, the only thing that shows in the log (under portainer) is the error listed in the subject. It just repeats over and over... I don't have a log in my config folder at the moment.

I do see this running the 9.3.1 version...

npm notice New major version of npm available! 9.5.0 -> 10.2.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.5
npm notice Run npm install -g [email protected] to update!
npm notice 

@kpine
Copy link
Contributor

kpine commented Dec 10, 2023

command: sh -c "apk --no-cache add curl & npm run start"

npm no longer exists in the container image due to recent changes (and as a side note I think that should be a && not &). I would not be messing with the container command at all unless you understand 100% how the container image is built. It could change to Debian in the future for all we know.

To fix it, you would need to install npm in your command. wget is already in the container though, so you can remove command (avoiding problems in the future) and use this instead:

healthcheck:
  test: ["CMD", "wget", "-q", "--spider", "http://localhost:8091/"]

But I don't think this health check is very effective, what scenario would ZUI be running but the UI not available? The recommended health check is a little more involved (here's a wget version).

@robertsLando Would it hurt to add curl to the container image?

@MYeager1967
Copy link
Author

I didn't add the command line, it came from one of the guides somewhere else. That said, I missed the reference to npm in it. As for the healthcheck, I'll check your version out as I'm always interested in a better way to do it although I think I already incorporated it from the github documentation. :-)

@robertsLando
Copy link
Member

Yeah like @kpine said the problem is the command you use to start the application, dunno where you picked that up from but I suggest to always refer to official docs:

https://zwave-js.github.io/zwave-js-ui/#/getting-started/docker?id=healthcheck

@MYeager1967
Copy link
Author

Back when I added the healthcheck, I didn't see anything in the docs about it. The command was added from another guide to add curl for the healthcheck. It's been long enough that I actually forgot about it and missed it when looking over things when it suddenly didn't work. Thank you for all for helping e figure this out. All is well again. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants