0
votes

I was having a problem when converting my Angular App into Angular Universal. I'm running this command " ng add @nguniversal/express-engine --clientProject my-app"

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/json-file' Require stack:

  • C:\Projects\my-app\node_modules@nguniversal\common\schematics\add\index.js
  • C:\Projects\my-app\node_modules@nguniversal\express-engine\schematics\install\index.js
  • C:\Projects\my-app\node_modules@angular-devkit\schematics\tools\export-ref.js
  • C:\Projects\my-app\node_modules@angular-devkit\schematics\tools\index.js
  • C:\Projects\my-app\node_modules@angular\cli\utilities\json-schema.js
  • C:\Projects\my-app\node_modules@angular\cli\models\command-runner.js
  • C:\Projects\my-app\node_modules@angular\cli\lib\cli\index.js
  • C:\Users\Administrator\AppData\Roaming\npm\node_modules@angular\cli\lib\init.js
  • C:\Users\Administrator\AppData\Roaming\npm\node_modules@angular\cli\bin\ng

Already checked the net but I can't see any error that is exactly the same as mine.

1

1 Answers

1
votes

I suspect this is an issue with Angular CLI version. Projects created with angular/cli v9 or 10 don’t have this file, but project created with angular/cli v11 have this file.

I copied the files (json-file.js, json-file.d.ts) from a v11 project to a v10 project, and the command works fine.