Skip to content

nodeenv --prebuilt on musl libc produces non-working binaries #204

Closed

Description

@asottile

Easiest reproduction is through using alpine with docker.

$ docker run -ti python:2.7.14-alpine3.7 sh -exc 'pip install nodeenv; nodeenv nenv; . nenv/bin/activate; node --version'
+ pip install nodeenv
Collecting nodeenv
  Downloading nodeenv-1.2.0.tar.gz
Building wheels for collected packages: nodeenv
  Running setup.py bdist_wheel for nodeenv ... done
  Stored in directory: /root/.cache/pip/wheels/6c/b7/e4/5073762ef06303f9f9e24a9640e049843ddd4ac0d6842e308b
Successfully built nodeenv
Installing collected packages: nodeenv
Successfully installed nodeenv-1.2.0
+ nodeenv nenv
 * Install prebuilt node (9.5.0) ..... done.
+ . nenv/bin/activate
+ deactivate_node nondestructive
+ [ -n  ]
+ [ -n  -o -n  ]
+ [ -n  ]
+ unset NODE_VIRTUAL_ENV
+ [ ! nondestructive = nondestructive ]
+ [  ]
+ NODE_VIRTUAL_ENV=/nenv
+ export NODE_VIRTUAL_ENV
+ _OLD_NODE_VIRTUAL_PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ PATH=/nenv/lib/node_modules/.bin:/nenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ export PATH
+ _OLD_NODE_PATH=
+ NODE_PATH=/nenv/lib/node_modules
+ export NODE_PATH
+ _OLD_NPM_CONFIG_PREFIX=
+ _OLD_npm_config_prefix=
+ NPM_CONFIG_PREFIX=/nenv
+ npm_config_prefix=/nenv
+ export NPM_CONFIG_PREFIX
+ export npm_config_prefix
+ [ -z  ]
+ _OLD_NODE_VIRTUAL_PS1=\w \$ 
+ [ x(nenv) != x ]
+ PS1=(nenv)\w \$ 
+ export PS1
+ [ -n  -o -n  ]
+ node --version
sh: node: not found

A workaround (I believe... it's still building) is to build from source:

apk --no-cache add gcc g++ make linux-headers
nodeenv nenv --source  # wait for an eternity

Originally reported here: https://github.com/pre-commit/mirrors-jshint/issues/4

I wonder if we can ignore prebuilt linux binaries if we're not using glibc?

Activity

  1. asottile commented on Feb 19, 2018

    @asottile
    ContributorAuthor

    I've additionally created an upstream issue asking for prebuilt binaries -- we'll see! nodejs/nodejs.org#1569

  2. hectorv commented on Feb 20, 2018

    @hectorv

    @asottile things seem to work fine if we first apk add nodejs and then pass system as the NODE_VER to create the environment:

    ❯ docker run -ti python:2.7.14-alpine3.7 sh -exc 'apk add --no-cache nodejs bash && pip install nodeenv && nodeenv -n system nenv && . nenv/bin/activate && node --version && npm --version'
    
    + apk add --no-cache nodejs bash
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
    (1/11) Installing pkgconf (1.3.10-r0)
    (2/11) Installing bash (4.4.19-r1)
    Executing bash-4.4.19-r1.post-install
    (3/11) Installing nodejs-npm (8.9.3-r0)
    (4/11) Installing c-ares (1.13.0-r0)
    (5/11) Installing libcrypto1.0 (1.0.2n-r0)
    (6/11) Installing libgcc (6.4.0-r5)
    (7/11) Installing http-parser (2.7.1-r1)
    (8/11) Installing libssl1.0 (1.0.2n-r0)
    (9/11) Installing libstdc++ (6.4.0-r5)
    (10/11) Installing libuv (1.17.0-r0)
    (11/11) Installing nodejs (8.9.3-r0)
    Executing busybox-1.27.2-r7.trigger
    OK: 87 MiB in 44 packages
    + pip install nodeenv
    Collecting nodeenv
      Downloading nodeenv-1.2.0.tar.gz
    Building wheels for collected packages: nodeenv
      Running setup.py bdist_wheel for nodeenv ... done
      Stored in directory: /root/.cache/pip/wheels/6c/b7/e4/5073762ef06303f9f9e24a9640e049843ddd4ac0d6842e308b
    Successfully built nodeenv
    Installing collected packages: nodeenv
    Successfully installed nodeenv-1.2.0
    + nodeenv -n system nenv
    + . nenv/bin/activate
    + deactivate_node nondestructive
    + [ -n  ]
    + [ -n  -o -n  ]
    + [ -n  ]
    + unset NODE_VIRTUAL_ENV
    + [ ! nondestructive = nondestructive ]
    + [  ]
    + NODE_VIRTUAL_ENV=/nenv
    + export NODE_VIRTUAL_ENV
    + _OLD_NODE_VIRTUAL_PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    + PATH=/nenv/lib/node_modules/.bin:/nenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    + export PATH
    + _OLD_NODE_PATH=
    + NODE_PATH=/nenv/lib/node_modules
    + export NODE_PATH
    + _OLD_NPM_CONFIG_PREFIX=
    + _OLD_npm_config_prefix=
    + NPM_CONFIG_PREFIX=/nenv
    + npm_config_prefix=/nenv
    + export NPM_CONFIG_PREFIX
    + export npm_config_prefix
    + [ -z  ]
    + _OLD_NODE_VIRTUAL_PS1=\w \$
    + [ x(nenv) != x ]
    + PS1=(nenv)\w \$
    + export PS1
    + [ -n  -o -n  ]
    + node --version
    v8.9.3
    + npm --version
    5.5.1
    

    Note that I also had to apk add bash because... Alpine.

    Now, is there a way to tie this back to https://github.com/pre-commit/mirrors-jshint/issues/4?

  3. asottile commented on Dec 11, 2019

    @asottile
    ContributorAuthor

    woohoo, upstream added musl binaries, I'll take a stab at making this work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions