nx: Generate @nrwl/node:application command not working
Current Behavior
When running the nx generate @nrwl/node:application <node-app> command, an error gets thrown.
Expected argument `jsonString` to be a `string`, got `object`
Expected Behavior
The command should work.
Environment
Node : 14.15.4
OS : win32 x64
yarn : 2.4.1
nx : 11.1.1
@nrwl/angular : Not Found
@nrwl/cli : 12.1.1
@nrwl/cypress : 12.1.1
@nrwl/devkit : 12.1.1
@nrwl/eslint-plugin-nx : 12.1.1
@nrwl/express : Not Found
@nrwl/jest : 12.1.1
@nrwl/linter : 12.1.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 12.3.4
@nrwl/react : 12.1.1
@nrwl/schematics : 8.12.11
@nrwl/tao : 12.1.1
@nrwl/web : 12.1.1
@nrwl/workspace : 12.1.1
@nrwl/storybook : 12.1.1
@nrwl/gatsby : Not Found
typescript : 4.2.4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (1 by maintainers)
I experienced the same issue.
I was able to fix it by:
yarn nx migrate latestyarnAfter this, the error was no more.
I ran into the same issue today using the @nrwl/gatsby generators as well as the @nrwl/node generators. After some debugging it looks like it was caused by the read method in the tree class of @nrwl/tao returning a buffer instead of a string due to the generator using the wrong version of the @nrwl/tao for some reason. The version causing the error was lacking the method signature “encoding” param present in the correct version.
I resolved it for now by adding @nrwl/tao as a dependency for my project. I’ll do some more looking into it later but hope this works for you!
@ochomoswill Awesome it’s work Thanks
`$ nx migrate latest Fetching meta data about packages. It may take a few minutes. Fetching @nrwl/workspace@latest Fetching @nrwl/cli@12.3.4 Fetching @nrwl/cypress@12.3.4 Fetching @nrwl/devkit@12.3.4 Fetching @nrwl/eslint-plugin-nx@12.3.4 Fetching @nrwl/express@12.3.4 Fetching @nrwl/jest@12.3.4 Fetching @nrwl/linter@12.3.4 Fetching @nrwl/node@12.3.4 Fetching @nrwl/react@12.3.4 Fetching @nrwl/storybook@12.3.4 Fetching @nrwl/tao@12.3.4 Fetching @nrwl/web@12.3.4 Fetching @nrwl/workspace@12.3.4
This has something to do with recents version, @Peter-NZ 's solution didn’t work for me with the Version 12.3.4 , i had to downgrade my project to version 11.4.0 of @nrwl/react in order to get it work.