minifierbeans icon indicating copy to clipboard operation
minifierbeans copied to clipboard

[BUG] Unable to minify files "bad interpreter: No such file or directory"

Open muelli1000 opened this issue 10 months ago • 13 comments

Describe the bug When I create an existing or new CSS/JS file, the error is displayed. No new file is created.

CSS: /bin/bash: /Users/daniel/.netbeans/minifierbeans/custom-packages/postcss: /bin/sh^M: bad interpreter: No such file or directory

JS: /bin/bash: /Users/daniel/.netbeans/minifierbeans/custom-packages/google-closure-compiler: /bin/sh^M: bad interpreter: No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. Installed the latest Version
  2. create a new CSS/JS file and saved it
  3. try to minify
  4. the Output Windows shows the error

Environment (please complete the following information):

  • OS: Mac OS 12.7.6
  • NetBeans version: 17
  • JDK version 17

Additional context I don't know if I miss something? Are there any requirements to this plugin?

Thx.

muelli1000 avatar Apr 06 '25 09:04 muelli1000

Hey, @muelli1000 thx for your report. It seems that there is smth weird with the shell. You have bin/bash, right? But it uses bin/sh?

Can you please check whether the file and folder in the error message exists on your machine? /Users/daniel/.netbeans/minifierbeans/custom-packages/postcss.

If this exists, please try to run the file directly from your machine to check the message. Also there needs to be a node_modules folder next to the cli files.

Chris2011 avatar Apr 06 '25 10:04 Chris2011

Hey, thanks for your help.

I checked the files and there are in the Folder. The Directory node_modules exists, too.

If I try to run the command manually in the terminal, I got this Error:

`internal/modules/run_main.js:54 internalBinding('errors').triggerUncaughtException( ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:720:11) at Loader.resolve (internal/modules/esm/loader.js:97:40) at Loader.getModuleJob (internal/modules/esm/loader.js:243:28) at ModuleWrap. (internal/modules/esm/module_job.js:42:40) at link (internal/modules/esm/module_job.js:41:36) { code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME' }`

my Command: node /Users/daniel/.netbeans/minifierbeans/custom-packages/node_modules/postcss-cli/index.js --config /Users/daniel/.netbeans/minifierbeans/custom-packages /Users/daniel/.netbeans/minifierbeans/custom-packages/testfile.css -o /Users/daniel/.netbeans/minifierbeans/custom-packages/testfile.min.css

Maybe you have another idea? Sorry, I'm no Node expert.

Thanks :)

muelli1000 avatar Apr 07 '25 08:04 muelli1000

No problem, thx for your test. I will check the error and come back to you when I know more.

Chris2011 avatar Apr 07 '25 08:04 Chris2011

You can also try the thing here #116

Chris2011 avatar Apr 07 '25 08:04 Chris2011

Thx. I changed the EOL in postcss and google-closure-compiler.

Now, there is no Error. But there is no new generated file.

Image Image

What could be the reason? With JS-Files is the same result.

muelli1000 avatar Apr 07 '25 09:04 muelli1000

You are doing right click on the CSS file -> Minify CSS, right?

Chris2011 avatar Apr 08 '25 06:04 Chris2011

Yes, I do.

If I run this command in the Terminal, I got a minimized File: node /Users/daniel/.netbeans/minifierbeans/custom-packages/node_modules/postcss-cli/index.js --config /Users/daniel/.netbeans/minifierbeans/custom-packages /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.css -o /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.min.css

Image

When I try it in Netbeans (right click -> Minify CSS), there is no error and unfortunately no minimized file :(.

muelli1000 avatar Apr 08 '25 07:04 muelli1000

can you please share the complete command in the output, i guess you can copy and paste the command with all arguments to see what it is called?

Chris2011 avatar Apr 08 '25 07:04 Chris2011

of course, here the complete command "/bin/bash" "-lc" "\"/Users/daniel/.netbeans/minifierbeans/custom-packages/postcss\" \"--config\" \"/Users/daniel/.netbeans/minifierbeans/custom-packages\" \"/Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.css\" \"-o\" \"/Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.min.css\""

I tried the command in the Terminal. No Output and no Error: /bin/bash -lc /Users/daniel/.netbeans/minifierbeans/custom-packages/postcss --config /Users/daniel/.netbeans/minifierbeans/custom-packages /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.css -o /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.min.css

muelli1000 avatar Apr 08 '25 07:04 muelli1000

I tried the command in the Terminal. No Output and no Error: /bin/bash -lc /Users/daniel/.netbeans/minifierbeans/custom-packages/postcss --config /Users/daniel/.netbeans/minifierbeans/custom-packages /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.css -o /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.min.css

This part means, that no file was created via CLI?

Chris2011 avatar Apr 08 '25 07:04 Chris2011

And if it was created successfully, please use the command with the quotes. Maybe there is smth wrong with quotation.

Chris2011 avatar Apr 08 '25 07:04 Chris2011

Yes, this command creates successful a minimized file: node /Users/daniel/.netbeans/minifierbeans/custom-packages/node_modules/postcss-cli/index.js --config /Users/daniel/.netbeans/minifierbeans/custom-packages /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.css -o /Users/daniel/Sites/p12/public/typo3conf/ext/msitepackage/Resources/Public/Css/testfile.min.css

testfile.css -> 79 KB testfile.min.css -> 48 KB and looks good.

There is no output using Netbeans or the Bash command in the terminal. I tried with quotes, too. Same result. No Output and no Error. My current Bash Version is 3.2.57(1)-release, maybe helpfull

muelli1000 avatar Apr 08 '25 07:04 muelli1000

Ok So with the exact command that NetBeans is using, it is not working in NetBeans and also not working in the blank terminal. Doesn't matter with or without quotes. So then there seems smth wrong in this part. Thx.

Chris2011 avatar Apr 08 '25 07:04 Chris2011