Nx: Prettier fails for `ng generate app ...`

Created on 11 Jan 2018  路  7Comments  路  Source: nrwl/nx

Issue is related with change in Prettier 1.10.2. bin/prettier.js has been changed to bin-prettier.js by https://github.com/prettier/prettier/issues/3574#issuecomment-356605745 so command from https://github.com/nrwl/nx/blob/3531323fb5210b995b1296a198c8e76ee8bf9a07/packages/schematics/src/command-line/format.ts#L59 does not work anymore.

Please check issue in Prettier repo: https://github.com/prettier/prettier/issues/3709

Most helpful comment

You can just downgrade to 1.10.1 FYI.

All 7 comments

This should resolve the issue:

-      `node ./node_modules/prettier/bin/prettier.js --single-quote --print-width 120 --write ${patterns.join(' ')}`,
+      `node ./node_modules/.bin/prettier --single-quote --print-width 120 --write ${patterns.join(' ')}`,

As a workaround I have downgrade: npm install [email protected] --save

You can just downgrade to 1.10.1 FYI.

Opened a PR #199

You can write "format": "prettier --write ... because node ./node_modules/.bin/prettier redundant

still error with --dry-run

npm install [email protected] -D
ng generate app myapp --routing --style=scss --dry-run 

This issue was fixed in 0.6.18.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasedwards picture jasedwards  路  3Comments

elliotmendiola picture elliotmendiola  路  3Comments

Svancara picture Svancara  路  3Comments

Koslun picture Koslun  路  3Comments

IonFoXx picture IonFoXx  路  3Comments