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: JsPrettier - [Errno 32] Broken pipe

See original GitHub issue

Explain 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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jonlabellecommented, Feb 15, 2020

Try removing the value for node_path in your config since it’s discovered automatically, and see what happens.

0reactions
lock[bot]commented, Apr 2, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IOError: [Errno 32] Broken pipe when piping: `prog.py
The problem is due to SIGPIPE handling. You can solve this problem using the following code: from signal import signal, SIGPIPE, ...
Read more >
Broken Pipe Error in Python
In the following tutorial, we will discuss [Errno 32] Broken pipe, a famous error message we have often seen while interacting with the...
Read more >
PYTHON : IOError: [Errno 32] Broken pipe when piping: `prog.py
PYTHON : IOError: [ Errno 32 ] Broken pipe when piping: `prog.py | othercmd` [ Gift : Animated Search Engine ...
Read more >
JsPrettier - Packages
JsPrettier is a Sublime Text Plug-in for Prettier, the opinionated code ... Package Control: Install Package , type the word JsPrettier, then select...
Read more >
error [err_require_esm]: require() of es module nanoid
js:950:32) { code: 'ERR_REQUIRE_ESM' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! PVWBOT@1.0.0 ...
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