maciejtreder / ng-toolkit

:star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more

Home Page:https://www.angular-universal-pwa.maciejtreder.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cwooi95 opened this issue · comments

I'm submitting an error when running ng add @nguniversal/express-engine@next --clientProject=roomer-app


[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

In package


[ ] @ng-toolkit/init
[ ] @ng-toolkit/serverless
[x] @ng-toolkit/universal
[ ] @ng-toolkit/pwa
[ ] @ng-toolkit/firebug

Current behavior

C02CW435MD6P:roomer-app ooicw$ ng add @nguniversal/express-engine@next --clientProject=roomer-app
Package has unmet peer dependencies. Adding the package may not succeed.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
An unhandled exception occurred: Cannot find module '@schematics/angular/utility/json-file'
Require stack:
- /Users/ooicw/Documents/roomer-app/node_modules/@nguniversal/common/schematics/add/index.js
- /Users/ooicw/Documents/roomer-app/node_modules/@nguniversal/express-engine/schematics/install/index.js
- /Users/ooicw/Documents/roomer-app/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /Users/ooicw/Documents/roomer-app/node_modules/@angular-devkit/schematics/tools/index.js
- /Users/ooicw/Documents/roomer-app/node_modules/@angular/cli/utilities/json-schema.js
- /Users/ooicw/Documents/roomer-app/node_modules/@angular/cli/models/command-runner.js
- /Users/ooicw/Documents/roomer-app/node_modules/@angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/@angular/cli/lib/init.js
- /usr/local/lib/node_modules/@angular/cli/bin/ng
See "/private/var/folders/d8/fm_5bcm15w5cxdh90zrry_0dn1tj8n/T/ng-vw5yaH/angular-errors.log" for further details.

Expected behavior

Install nguniversal for SSR SEO

Minimal reproduction of the problem with instructions

When running "ng add @nguniversal/express-engine@next --clientProject=roomer-app", (roomer-app is my project directory), I always get the error of "An unhandled exception occurred: Cannot find module '@schematics/angular/utility/json-file'"
angular-errors.log

Example repository

Package.json

{
  "name": "roomer-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:prod": "ng build --prod --aot --vendor-chunk --common-chunk --delete-output-path --buildOptimizer",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.1.0",
    "@angular-material-extensions/select-country": "1.1.0",
    "@angular/animations": "^9.1.9",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "^9.1.3",
    "@angular/compiler": "^9.1.3",
    "@angular/core": "^9.1.3",
    "@angular/fire": "^6.0.0",
    "@angular/flex-layout": "^9.0.0-beta.29",
    "@angular/forms": "^9.1.9",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "^9.1.3",
    "@angular/platform-browser-dynamic": "^9.1.3",
    "@angular/platform-server": "^11.2.3",
    "@angular/router": "^9.1.3",
    "@angular/service-worker": "^9.1.3",
    "@kolkov/ngx-gallery": "^1.2.0",
    "@material/elevation": "^5.1.0",
    "@ng-toolkit/universal": "^8.0.3",
    "@nguniversal/express-engine": "^11.1.0-next.0",
    "@schematics/angular": "^9.1.15",
    "@tensorflow/tfjs": "^2.0.1",
    "@typeform/embed": "^0.22.0",
    "@types/googlemaps": "^3.39.11",
    "angularfire2": "^5.4.2",
    "angularx-social-login": "^2.3.1",
    "chart.js": "^2.9.3",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "firebase": "^7.14.3",
    "firebase-admin": "^8.12.1",
    "firebase-functions": "^3.6.2",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "ng-gallery": "^5.0.0-beta.2",
    "ng2-charts": "^2.3.0",
    "ng5-slider": "^1.2.4",
    "ngx-doughnut-chart": "0.0.4",
    "ngx-lightbox": "^2.1.2",
    "ngx-pagination": "^5.0.0",
    "ngx-paginator": "0.0.14",
    "ngx-stripe": "^9.0.2",
    "npm-update": "^2.1.0",
    "npm-upgrade": "^2.0.3",
    "package.json": "^2.0.1",
    "rxjs": "^6.5.5",
    "svg-country-flags": "^1.2.7",
    "tslib": "^1.11.1",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.900",
    "@angular-devkit/build-angular": "^0.901.12",
    "@angular/cli": "^9.1.15",
    "@angular/compiler-cli": "^9.1.3",
    "@angular/language-service": "^9.1.3",
    "@nativescript/schematics": "^11.0.0",
    "@types/hammerjs": "^2.0.36",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.12.44",
    "@types/stripe-checkout": "^1.0.3",
    "@types/stripe-v3": "^3.1.17",
    "bufferutil": "^4.0.3",
    "codelyzer": "^5.2.2",
    "compression-webpack-plugin": "^6.0.4",
    "firebase-tools": "^8.0.0",
    "fuzzy": "^0.1.3",
    "inquirer": "^6.2.2",
    "inquirer-autocomplete-prompt": "^1.0.1",
    "jasmine-core": "^3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^5.0.9",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.3",
    "license-webpack-plugin": "^2.3.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "^3.7.5",
    "utf-8-validate": "^5.0.4",
    "webpack": "^4.43.0",
    "ws": "^7.4.3",
    "xhr2": "^0.2.1"
  }
}

What is the motivation / use case for changing the behavior?

To allow google search able to crawl my angular website by enabling Angular SSR SEO.

Environment




Angular CLI: 9.1.15
Node: 12.18.3
OS: darwin x64

Angular: 9.1.3


Others: