blade-formatter icon indicating copy to clipboard operation
blade-formatter copied to clipboard

Couldn't resolve parser "php" in local installation

Open pboese opened this issue 3 years ago • 4 comments

Context (Environment)

We're trying to use blade-formatter in a Laravel 8 project on the latest MacOS but it can't resolve the PHP parser. It does work when installing globally but we'd rather have it locally if possible.

Thanks for any help in advance!

Current Behavior

Every call results in the following error for every blade template checked

{
  path: 'resources/views/xxx/show.blade.php',
  message: `Couldn't resolve parser "php"`,
  error: ConfigError$1: Couldn't resolve parser "php"
      at resolveParser$1 (/xxx/node_modules/blade-formatter/node_modules/prettier/index.js:12487:13)
      at normalize$1 (/xxx/node_modules/blade-formatter/node_modules/prettier/index.js:12582:18)
      at formatWithCursor$1 (xxx/node_modules/blade-formatter/node_modules/prettier/index.js:14265:46)
      at /xxx/node_modules/blade-formatter/node_modules/prettier/index.js:59304:12
      at Object.format (/xxx/node_modules/blade-formatter/node_modules/prettier/index.js:59324:12)
      at formatStringAsPhp (/xxx/node_modules/blade-formatter/src/util.js:42:19)
      at /xxx/node_modules/blade-formatter/src/util.js:133:16
      at String.replace (<anonymous>)
      at Function.replace (/xxx/node_modules/lodash/lodash.js:14608:48)
      at /xxx/node_modules/blade-formatter/src/util.js:132:9
}

Expected Behavior

No error message :-)

Steps to Reproduce

  1. npm install --save-dev blade-formatter
  2. node_modules/.bin/blade-formatter resources/**/*.blade.php

pboese avatar Sep 22 '21 07:09 pboese

Any fix to this?

HDVinnie avatar Oct 21 '21 16:10 HDVinnie

@shufo

HDVinnie avatar Nov 02 '21 17:11 HDVinnie

Tried installation on mac machine on CI and exec formatter but it seems format successfully. https://github.com/shufo/blade-formatter/runs/4090339705?check_suite_focus=true

@pboese Can you provide more specific information like package list in package.json, mac os version or node version, etc?

shufo avatar Nov 03 '21 09:11 shufo

I used the docker and don't have the issue anymore.

HDVinnie avatar Nov 03 '21 23:11 HDVinnie

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Dec 06 '22 01:12 github-actions[bot]