Cli: [BUG] cb() never called - without git installed

Created on 23 Feb 2020  路  8Comments  路  Source: npm/cli

What / Why

If git is not installed npm install crashes with the famous unspecified error of cb() never called.

When

Whenever I run npm install

Where

bitwarden-cli project

How

Current Behavior

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/bitwarden-cli/src/npm_cache/_logs/2020-02-23T10_59_29_528Z-debug.log
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /srv/aur/chroot/user/build

Steps to Reproduce

  1. create a new empty folder
  2. run git init .
  3. Create a Dockerfile this as content:
FROM archlinux:latest AS common_builder
RUN pacman -Syu --needed --noconfirm --noprogressbar
RUN pacman -S --needed --noconfirm --noprogressbar base base-devel sudo
RUN useradd -s /bin/bash foo && mkdir /home/foo && chown foo:foo /home/foo
WORKDIR /home/foo

FROM common_builder AS nvm_builder
USER foo
COPY --chown=1000:1000 nvm /home/foo/nvm
RUN cd nvm && PKGDEST=/tmp /usr/sbin/makepkg

FROM common_builder AS bitwarden_builder
RUN pacman -S --needed --noconfirm --noprogressbar nodejs npm
COPY --from=nvm_builder /tmp/nvm-0.35.2-1-any.pkg.tar.xz /tmp/nvm-any.pkg.tar.xz
RUN pacman -U --needed --noconfirm --noprogressbar /tmp/nvm-any.pkg.tar.xz
USER foo
COPY --chown=1000:1000 bitwarden-cli /home/foo/bitwarden-cli
RUN cd bitwarden-cli && PKGDEST=/tmp /usr/sbin/makepkg
  1. run git submodule add -b master https://aur.archlinux.org/nvm.git
  2. run git submodule add -b master https://aur.archlinux.org/bitwarden-cli.git
  3. build the build container using docker build .
    Now it fails. Than replace RUN pacman -S --needed --noconfirm --noprogressbar base base-devel sudo with RUN pacman -S --needed --noconfirm --noprogressbar base base-devel sudo git and run docker build . again. This time it succeeds as expected.

Expected Behavior

npm install either succeeding without git, or git being listed as dependency, as well as the error message indicating it being missing.

Who



  • n/a

References



  • n/a

Bug

Most helpful comment

The error occurred beforehand I just created the docker file above to provide a reproducible way that causes the issue.

All 8 comments

1. https://aur.archlinux.org/nvm.git

This is expected if you provide a Git URL. Without Git it will fail because this will clone the repository from this URL.

npm ERR! cb() never called!

This is not the complete output / log. The actual error should be above / before this.

If it does, I don't see it:

Step 16/16 : RUN cd bitwarden-cli && PKGDEST=/tmp /usr/sbin/makepkg
 ---> Running in b89c2e8ba416
==> Making package: bitwarden-cli 1.8.0-1 (Sun 23 Feb 2020 06:03:28 PM UTC)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading bitwarden-cli-1.8.0.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   121    0   121    0     0    381      0 --:--:-- --:--:-- --:--:--   380
100 98683    0 98683    0     0   104k      0 --:--:-- --:--:-- --:--:--  104k
  -> Downloading jslib-e16cb9b801bec1cf1744d8b48f39421ad37e1644.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   157    0   157    0     0    588      0 --:--:-- --:--:-- --:--:--   585
100  273k    0  273k    0     0   253k      0 --:--:--  0:00:01 --:--:--  253k
==> Validating source files with sha512sums...
    bitwarden-cli-1.8.0.tar.gz ... Passed
    jslib-e16cb9b801bec1cf1744d8b48f39421ad37e1644.tar.gz ... Passed
==> Extracting sources...
  -> Extracting bitwarden-cli-1.8.0.tar.gz with bsdtar
  -> Extracting jslib-e16cb9b801bec1cf1744d8b48f39421ad37e1644.tar.gz with bsdtar
==> Starting prepare()...
==> Starting build()...
Downloading and installing node v10.16.0...
Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v10.16.0 (npm v6.9.0)
Creating default alias: default -> 10.16.0 (-> v10.16.0 *)
Now using node v10.16.0 (npm v6.9.0)
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/foo/bitwarden-cli/src/npm_cache/_logs/2020-02-23T18_03_50_181Z-debug.log
==> ERROR: A failure occurred in build().
    Aborting...
The command '/bin/sh -c cd bitwarden-cli && PKGDEST=/tmp /usr/sbin/makepkg' returned a non-zero code: 4

And this is the full logfile: 2020-02-23T18_03_50_181Z-debug.log

This is expected if you provide a Git URL. Without Git it will fail because this will clone the repository from this URL.

This is ok, but can we please get a better error message for this?

In this case, you鈥檙e using nvm to invoke npm - presumably with a default-packages file or the reinstall-packages-from option.

Can you reproduce it without those, so you鈥檙e the one explicitly running the npm install -g command?

Can you reproduce it without those, so you鈥檙e the one explicitly running the npm install -g command?

I don't know how, I've not done much using nvm and npm until now, but from looking into the PKGBUILD file, it already invokes npm install directly and not nvm is that what you mean?

If the npm install causes the error, and it is reproducible on further npm install commands, then it doesn鈥檛 have to do with nvm.

Yes, but i mean, have you shelled into the docker container, and ran npm install, and seen the same error again?

The error occurred beforehand I just created the docker file above to provide a reproducible way that causes the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisspen picture chrisspen  路  3Comments

MadhuriGurumurthy11 picture MadhuriGurumurthy11  路  3Comments

darcyclarke picture darcyclarke  路  3Comments

CliffS picture CliffS  路  3Comments

DullReferenceException picture DullReferenceException  路  4Comments