Menu

#2372 Binary download fails on "gauge" rendering w/ diverted stdout or simple tty's

open
nobody
None
2018-06-27
2018-05-07
Anonymous
No

Originally created by: jvanharn

Problem

During the downloading of a binary for Node-sass it displays an "gauge", it however does not take into account the capabilities of the terminal. (E.g. if it can show a gauge).

It only occurs when:
* You do not already have a binary in your cache (Because the gauge is not shown if you have it cached)
* You run npm install (and thus the node-sass install script) in a console-like tty without color etc, or by using the reproduction case below, where the stdout is diverted.

Exerpt from the generated error:

> node-sass@4.9.0 install /home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node
/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:67
          throw new error.MissingTemplateValue(cloned, values)
          ^

Error: Missing template value "progressbar"
    at cloneAndObjectify (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:67:17)
    at Array.map (<anonymous>)
    at prepareItems (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:83:25)
    at module.exports (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:16:15)
    at module.exports.Plumbing.show (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/plumbing.js:45:10)
    at Gauge._doRedraw (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/index.js:226:40)
    at Timeout.<anonymous> (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/index.js:15:19)
    at ontimeout (timers.js:482:11)
    at Timer.unrefdHandle (timers.js:595:5)

Solution:

Only show "gauge" during downloading if terminal/tty supports it, like npm does.

Reproduction:

In a project with node-sass 4.9.0 as a dependency, launch npm install in a simple tty or with diverted stdout/stderr. Without a locally cached copy of the binary.

npm cache clear --force
npm install --no-save 2> >(grep --color=always -v "SKIPPING OPTIONAL DEPENDENCY" 1>&2)

Workaround

Switch out your CI-system with one that supports a full tty, and or (when working locally) dont divert the TTY, e.g. dont pipe the output of npm install generally.

Info

  • NPM version (npm -v): 6.0.0
  • Node version (node -v): 8.11.1
  • Node Process (node -p process.versions):

    :::js
    { http_parser: '2.8.0',
    node: '8.11.1',
    v8: '6.2.414.50',
    uv: '1.20.2',
    zlib: '1.2.11',
    ares: '1.13.0',
    modules: '57',
    nghttp2: '1.31.0',
    openssl: '1.1.0g',
    icu: '61.1',
    unicode: '10.0',
    cldr: '33.0',
    tz: '2018c' }
    - Node Platform (node -p process.platform): linux
    - Node architecture (node -p process.arch): x64
    - node-sass version (node -p "require('node-sass').info"): n.a.
    - npm node-sass versions (npm ls node-sass): n.a.

Discussion

  • Anonymous

    Anonymous - 2018-05-07

    Originally posted by: xzyfer

    Thanks for the report. I've heard node has an istty flag but I'm not sure
    the reliability of it is.

    On Mon., 7 May 2018, 4:41 pm J. van Harn, notifications@github.com wrote:

    Problem

    During the downloading of a binary for Node-sass it displays an "gauge",
    it however does not take into account the capabilities of the terminal.
    (E.g. if it can show a gauge).

    It only occurs when:

    • You do not already have a binary in your cache (Because the gauge is
      not shown if you have it cached)
    • You run npm install (and thus the node-sass install script) in a
      console-like tty without color etc, or by using the reproduction case
      below, where the stdout is diverted.

    Exerpt from the generated error:

    node-sass@4.9.0 install /home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/node-sass
    node scripts/install.js

    Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node
    /home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:67 https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:67
    throw new error.MissingTemplateValue(cloned, values)
    ^

    Error: Missing template value "progressbar"
    at cloneAndObjectify (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:67:17)
    at Array.map (<anonymous>)
    at prepareItems (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:83:25)
    at module.exports (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/render-template.js:16:15)
    at module.exports.Plumbing.show (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/plumbing.js:45:10)
    at Gauge._doRedraw (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/index.js:226:40)
    at Timeout.<anonymous> (/home/jeffrey/projects/sheva/libraries/angular/i18n/node_modules/gauge/index.js:15:19)
    at ontimeout (timers.js:482:11)
    at Timer.unrefdHandle (timers.js:595:5)</anonymous></anonymous>

    Solution:

    Only show "gauge" during downloading if terminal/tty supports it, like npm
    does.
    Reproducuction:

    In a project with node-sass 4.9.0 as a dependency, launch npm install in a
    simple tty or with diverted stdout/stderr. Without a locally cached copy of
    the binary.

    npm cache clear --force
    npm install --no-save 2> >(grep --color=always -v "SKIPPING OPTIONAL DEPENDENCY" 1>&2)

    Workaround

    Switch out your CI-system with one that supports a full tty, and or (when
    working locally) dont divert the TTY, e.g. dont pipe the output of npm
    install generally.
    Info

    • NPM version (npm -v): 6.0.0
    • Node version (node -v): 8.11.1
    • Node Process (node -p process.versions):

    { http_parser: '2.8.0',
    node: '8.11.1',
    v8: '6.2.414.50',
    uv: '1.20.2',
    zlib: '1.2.11',
    ares: '1.13.0',
    modules: '57',
    nghttp2: '1.31.0',
    openssl: '1.1.0g',
    icu: '61.1',
    unicode: '10.0',
    cldr: '33.0',
    tz: '2018c' }

    • Node Platform (node -p process.platform): linux
    • Node architecture (node -p process.arch): x64
    • node-sass version (node -p "require('node-sass').info"): n.a.
    • npm node-sass versions (npm ls node-sass): n.a.


    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    https://github.com/sass/node-sass/issues/2372, or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAjZWFm-WV27b8h9-02NSDMhJLNxkq5rks5twF0ngaJpZM4T1Fwh
    .

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.