Closed olegat closed 1 year ago
I believe this is related to this issue, when I used the branch in the PR it fixed this issue for me
Could be. My project uses prettier 3:
./node_modules/prettier/bin/prettier.cjs --version
3.0.3
I will try with that branch. Thanks for the guidance.
I've tried building that branch, but it looks like one of the required node modules doesn't support Apple M2 processors.
% make
cp COPYING dist/COPYING
cp node_modules/diff-match-patch/LICENSE dist/COPYING-diff-match-patch
emacs -batch --load=./build-tools/create-pkg-el.el --eval='(prettier--create-pkg-el "dist/prettier-pkg.el")'
cp prettier.el dist/prettier.el
node_modules/.bin/google-closure-compiler \
--js_output_file=build/prettier-el-min.js \
--module_resolution=NODE \
--process_common_js_modules \
--compilation_level=ADVANCED_OPTIMIZATIONS \
--js \
prettier-el.js \
node_modules/diff-match-patch/index.js \
--externs externs.js \
--hide_warnings_for=node_modules/diff-match-patch \
--dependency_mode=NONE
prettier-el.js:445 (JSC_TYPE_MISMATCH)
array destructuring rhs must be Iterable
found : module$node_modules$diff_match_patch$index.default.Diff
required: Iterable
const [kind, str] = diffResult[index];
^
node -e "const fs = require('fs'); const zopfli = require('node-zopfli-es'); fs.createReadStream('build/prettier-el-min.js').pipe(zopfli.createGzip()).pipe(process.stdout)" \
| base64 --wrap=70 > dist/prettier-el.js.gz.base64
base64: invalid argument --wrap=70
Usage: base64 [-hDd] [-b num] [-i in_file] [-o out_file]
-h, --help display this message
-Dd, --decode decodes input
-b, --break break encoded string into num character lines
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
node:internal/modules/cjs/loader:1340
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: dlopen(/Users/olegat/github.com/asbish/prettier.el/node_modules/node-zopfli-es/lib/binding/zopfli.node, 0x0001): tried: '/Users/olegat/github.com/asbish/prettier.el/node_modules/node-zopfli-es/lib/binding/zopfli.node' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/olegat/github.com/asbish/prettier.el/node_modules/node-zopfli-es/lib/binding/zopfli.node' (no such file), '/Users/olegat/github.com/asbish/prettier.el/node_modules/node-zopfli-es/lib/binding/zopfli.node' (not a mach-o file)
at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/Users/olegat/github.com/asbish/prettier.el/node_modules/node-zopfli-es/lib/zopfli.js:5:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12) {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v18.17.1
make: *** [dist/prettier-el.js.gz.base64] Error 64
It might be simpler for me to watch PR #124 and try again once it's merged and released.
@olegat
Could you try to installing from a pre-built package?
https://github.com/jscheid/prettier.el/blob/master/RELEASING.md#installing-prs
Also you can find the artifact prettier-1.3.0.178snapshot.tar
here: https://github.com/jscheid/prettier.el/actions/runs/5646979357
Works like a charm! Thanks a lot of the help.
Describe the bug prettier.el fails to format the buffer when using the
@trivago/prettier-plugin-sort-imports
module.Link to
M-x prettier-info
output https://gist.github.com/olegat/cd11f5b552e240942b5bcae97648f9deTo Reproduce
cd /path/to/cloned/ag-charts
npm i -g yarn nx
yarn install
M-x prettier-prettify
Expected behavior The buffer should be formatted without errors.
Actual behavior prettier.el fails to format the buffer with the following error output to
*prettier errors*
:Additional context
@trivago/prettier-plugin-sort-imports
module was added in commit 05e9d5bc457d46ee2f791a1c51e7ecc4c9d2cd4bnx format
command (working directory: root of ag-charts project).