error: JsPrettier - [Errno 32] Broken pipe
See original GitHub issueExplain the Issue and Expected Behavior
When running the command “JsPrettier: Format Code” on *.vue files, I get the “Broken pipe” error, when running it on a *.ts or *.scss file, I get a syntax error instead of Prettier formatting the code.
Prettier version
1.18.2
JsPrettier Plug-in Version
(is the module sublime-js-prettier
needed at all? I never used it before but installed it right now - the issues remain the same, though. So far I only installed the module prettier
(^1.19.1
) in my package.json
and JsPrettier
in ST3)
"name": "sublime-js-prettier",
"version": "^1.28.6",
Platform Details
Provide your Sublime Text version and Platform details.
- Sublime Text Version: 3.2.2
- Sublime Text Build: 3211
- Sublime Text Architecture: 64bit
- Operating System Name: Windows 10 Enterprise
- Operating System Version: 1909
- Operating System Architecture: 64bit
Generated Prettier command line arguments
To view the generated prettier command line arguments you need to enable JsPrettier’s [debug setting] and open the Sublime Text Console after a file/section formatting attempt.
When trying to format a *.vue file, Prettier reports the following output:
-----------------------------------------
JsPrettier DEBUG - Prettier CLI Command
-----------------------------------------
C:\Program Files\nodejs\node.exe C:\Users\RomanSeidelsohn\Development\hubble\node_modules\.bin\prettier.cmd --stdin --parser vue --use-tabs false --ignore-path C:\Users\RomanSeidelsohn\Development\hubble\.prettierignore --stdin-filepath C:\Users\RomanSeidelsohn\Development\hubble\src\components\InfographicHorizontalBar.vue --loglevel debug --config C:\Users\RomanSeidelsohn\OneDrive - DKB Code Factory GmbH\Dokumente\Sublime projects/.prettierrc --cursor-offset 3534
error: JsPrettier - [Errno 32] Broken pipe
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
return self.run(edit)
File "C:\Users\RomanSeidelsohn\AppData\Roaming\Sublime Text 3\Packages\JsPrettier\JsPrettier.py", line 282, in run
provide_cursor=self.disable_prettier_cursor_offset is False, is_selection=False)
File "C:\Users\RomanSeidelsohn\AppData\Roaming\Sublime Text 3\Packages\JsPrettier\JsPrettier.py", line 412, in format_code
stdout, stderr = proc.communicate(input=source.encode('utf-8'))
File "./python3.3/subprocess.py", line 920, in communicate
File "./python3.3/subprocess.py", line 1206, in _communicate
BrokenPipeError: [Errno 32] Broken pipe
When trying to format a *.ts or *.scss file, Prettier reports the following output:
-----------------------------------------
JsPrettier DEBUG - Prettier CLI Command
-----------------------------------------
C:\Program Files\nodejs\node.exe C:\Users\RomanSeidelsohn\Development\hubble\node_modules\.bin\prettier.cmd --stdin --parser typescript --use-tabs false --ignore-path C:\Users\RomanSeidelsohn\Development\hubble\.prettierignore --stdin-filepath C:\Users\RomanSeidelsohn\Development\hubble\src\helpers\contentHelper.ts --loglevel debug --config C:\Users\RomanSeidelsohn\OneDrive - DKB Code Factory GmbH\Dokumente\Sublime projects/.prettierrc --cursor-offset 1892
------------------
JsPrettier ERROR
------------------
Prettier reported the following output:
C:\Users\RomanSeidelsohn\Development\hubble\node_modules\.bin\prettier.cmd:1
@IF EXIST "%~dp0\node.exe" (
^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:891:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
Prettier process finished with exit code 1.
Is the same behavior observed when run against Prettier directly?
no
The contents of your User/JsPrettier.sublime-settings
file
{
"debug": true,
"prettier_cli_path": "C:/Users/RomanSeidelsohn/Development/hubble/node_modules/.bin/prettier.cmd",
"node_path": "C:\\Program Files\\nodejs\\node.exe",
"auto_format_on_save": true,
"auto_format_on_save_excludes": ["*/node_modules/*"],
"auto_format_on_save_requires_prettier_config": false,
"allow_inline_formatting": true,
"custom_file_extensions": [],
"max_file_size_limit": -1,
"disable_tab_width_auto_detection": true,
"disable_prettier_cursor_offset": false,
"additional_cli_args": {
"--config": "${project_path}/.prettierrc"
},
"prettier_options": {
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"parser": "babel",
"semi": true,
"requirePragma": false,
"proseWrap": "preserve",
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "css",
"quoteProps": "as-needed",
"vueIndentScriptAndStyle": true
}
}
The contents of your <project_name>.sublime-project
file (if applicable)
The entire contents of your User overridden JsPretter Project-level Settings, excluding the comments.
{
"folders":
[
{
"path": "C:\\Users\\RomanSeidelsohn\\Development\\hubble"
}
],
"settings":
{
}
}
Steps to reproduce the behavior
The steps one would take to reproduce and observe the problem.
1a. Open a *.vue file
2a. Run the command "JsPrettier: Format Code"
==> error: JsPrettier - [Errno 32] Broken pipe
1b. Open an *.scss file
2b. Run the command "JsPrettier: Format Code"
==> JsPrettier ERROR
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Try removing the value for
node_path
in your config since it’s discovered automatically, and see what happens.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.