Minify: [bug] Error: Reading input from STDIN. Cannot take file params

Created on 9 Nov 2017  ·  10Comments  ·  Source: babel/minify

Running

minify src/js/sideNav.js --mangle.keepClassName --deadcode.keepFnArgs --outFile main.js.min

From the terminal works fine...

However when I run it through tup I get,

Error: Reading input from STDIN. Cannot take file params   

I have it installed with

yarn global add babel-minify
bug help wanted needs info

Most helpful comment

I've not used tup. Maybe you can help debug what happens in tup and apply a fix that works everywhere. PR welcome. Thanks.

This is how we decide which input form to take - https://github.com/babel/minify/blob/9d4fbfa52988c47f1482bee2c87a603598622c1c/packages/babel-minify/src/cli.js#L258-L268

All 10 comments

I've not used tup. Maybe you can help debug what happens in tup and apply a fix that works everywhere. PR welcome. Thanks.

This is how we decide which input form to take - https://github.com/babel/minify/blob/9d4fbfa52988c47f1482bee2c87a603598622c1c/packages/babel-minify/src/cli.js#L258-L268

I'm receiving same error message when I am trying to use it with nodemon .

In my npm scripts, I've got this command:"babel:min": "nodemon --watch library --exec \"minify library -d bin\""

In terminal I get following:

❯ npm run babel:min

> ******@0.1.0 babel:min C:\Users\xeho91\**\**
> nodemon --watch library --exec "minify library -d bin"

[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: C:\Users\xeho91\GitHub\boilerplate\library/**/*
[nodemon] starting `minify library/boilerplate.js -d bin/boilerplate.js`
Error: Reading input from STDIN. Cannot take file params
[nodemon] app crashed - waiting for file changes before starting...

Depedencies:
"@babel/cli": "^7.0.0-beta.31",
"@babel/core": "^7.0.0-beta.31",
"@babel/node": "^7.0.0-beta.31",
"@babel/polyfill": "^7.0.0-beta.31",
"@babel/preset-env": "^7.0.0-beta.31",
"babel-eslint": "^8.0.2",
"babel-minify": "^0.2.0",
"nodemon": "^1.12.1",

System: Windows 10 x64
NodeJS: v8.9.1 LTS
npm: v.5.5.1

I'm having the same error when running through make.

babel-minify dist/$*.js >> $@

Happens to me also when I run npm publish. Here are the relevant scripts

  "build": "rollup -c && npm run minify",
  "minify": "minify build/get-package-github-url.js --out-file build/get-package-github-url.min.js",
  "prepublishOnly": "npm run build"

I'm not able to reproduce this by calling minify from a makefile or package.json script or nodemon's exec script. Can someone help create a repo that reproduces this issue ?

Works for me now, maybe a dependency was fixed?

Scratch that, I went back to the commit that was broken for me before, and it's still broken now:

https://travis-ci.org/curiousdannii/ifvms.js/builds/322875737

It's now in a branch for you to easily check out.

Same for me when using inside Docker (e.g. with docker build).
Dockerfile:

RUN npm run compress:scripts

package.json's scripts:

"compress:scripts": "minify ./public/scripts.js -d ./public"

Output:

Error: Reading input from STDIN. Cannot take file params

A possible workaround, since minify is outputting to STDIN by default, and if you're using no arguments but -d is to use following notation:

minify < ./public/scripts.js > ./public/scripts.min.js

Note that you'll need to provide different name for the minified file.

@boopathi I've just rerun it on Travis (so it's downloading the latest compatible packages) and the error still occurs. Hope the test case helps. Let me know if I can provide any more info.

Is there any way to move this forward? Can I provide any extra information?

Edit: I only just noticed that you'd published 0.3.0. My tests now pass: https://travis-ci.org/curiousdannii/ifvms.js/builds/359896556

If no one else is still having issues, I guess it's time to close this. Thanks whoever fixed it!

I'm closing this. Please comment to reopen this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

babel-bot picture babel-bot  ·  3Comments

zamb3zi picture zamb3zi  ·  3Comments

kristianmandrup picture kristianmandrup  ·  6Comments

callym picture callym  ·  4Comments

hzoo picture hzoo  ·  5Comments