question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using stdin

See original GitHub issue

I have this in file.js:

function hello() { 
	if (2 > 3) 
		console.log('for real');
}

I can run minify and pass the filename:

> minify file.js
[ 'function hello(){0}' ]
>

But I can’t pass in the content through stdin:

> cat file.js | minify --js
TypeError: minify[name](...).then is not a function
    at processStream (/home/sturm/.nvm/versions/node/v8.11.3/lib/node_modules/minify/bin/minify.js:68:10)
    at Socket.read (/home/sturm/.nvm/versions/node/v8.11.3/lib/node_modules/minify/bin/minify.js:39:9)
    at emitNone (events.js:106:13)
    at Socket.emit (events.js:208:7)
    at emitReadable_ (_stream_readable.js:513:10)
    at emitReadable (_stream_readable.js:507:7)
    at onEofChunk (_stream_readable.js:492:3)
    at readableAddChunk (_stream_readable.js:220:5)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:626:8)
>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mwczcommented, Nov 15, 2018

👍 works like a charm.

1reaction
mwczcommented, Nov 14, 2018

@coderaiser Unfortunately I’m still seeing this in v4.0.2 and on master.

Repro:

git clone https://github.com/coderaiser/minify.git
cd minify
npm install
cd bin
echo "body { color: #ffffff; }" | ./minify.js --css

Result:

TypeError: minify[name](...).then is not a function
    at processStream (/home/mclayton/projects/minify/bin/minify.js:68:10)
    at Socket.read (/home/mclayton/projects/minify/bin/minify.js:39:9)
    at Socket.emit (events.js:182:13)
    at emitReadable_ (_stream_readable.js:534:12)
    at onEofChunk (_stream_readable.js:512:7)
    at readableAddChunk (_stream_readable.js:232:5)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:125:12)

Versions:

$ npm version
{ minify: '4.0.2',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.33.0',
  node: '10.11.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.0',
  v8: '6.8.275.32-node.28',
  zlib: '1.2.11' }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in using Stdin.readLineSync(); in dart - Stack Overflow
The error you get with stdin.readLineSync() is due to null safety introduced in Dart 2.12. Just add (!) var name = stdin.readLineSync()!;.
Read more >
Error reading from stdin · Issue #1364 - GitHub
Have Swiper/Ivy/Counsel installed, and run emacs as a daemon. Then connect from emacsclient(might need to restart daemon a few times, its about ...
Read more >
Why does my code get a <stdin> syntax error?
Google says the most common occurrence of this error message is when the script is attempted to be opened inside of the command...
Read more >
Standard Input, Standard Output, and Standard Error
Generally, when a command starts, three files are already open: stdin (standard input), stdout (standard output), and stderr (standard error).
Read more >
Writing data to file - User input and error handling
stdout as outfile , the x2f function also works with standard input and/or standard output. Without sys.stdin and sys.stdout , we would need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found