[BUG] Unable to minify files "bad interpreter: No such file or directory"
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:
- Installed the latest Version
- create a new CSS/JS file and saved it
- try to minify
- 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.
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.
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.
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 :)
No problem, thx for your test. I will check the error and come back to you when I know more.
You can also try the thing here #116
Thx. I changed the EOL in postcss and google-closure-compiler.
Now, there is no Error. But there is no new generated file.
What could be the reason? With JS-Files is the same result.
You are doing right click on the CSS file -> Minify CSS, right?
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
When I try it in Netbeans (right click -> Minify CSS), there is no error and unfortunately no minimized file :(.
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?
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
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?
And if it was created successfully, please use the command with the quotes. Maybe there is smth wrong with quotation.
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
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.