plone / plone.restapi-angular

A simple Angular SDK to build web sites easily on top of the Plone RESTAPI
MIT License
12 stars 11 forks source link

Cannot run fresh install #88

Open eugenehiggins opened 4 years ago

eugenehiggins commented 4 years ago

Sorry, I created another issue while logged in as the wrong account. I realized I would not be receiving email notifications, and wasn't sure who would be receiving them, so I closed that and opened another. Apologies.

Following the instructions at https://training.plone.org/5/angular/using.html I cannot run the example app. The angular app does compile but displays an error in the browser console:

ERROR TypeError: Class constructor Resolver cannot be invoked without 'new'
    at new RESTAPIResolver (traversal.js:59)
    at _createClass (core.js:30462)
    at _createProviderInstance (core.js:30425)
    at resolveNgModuleDep (core.js:30372)
    at NgModuleRef_.get (core.js:31577)
    at injectInjectorOnly (core.js:734)
    at ɵɵinject (core.js:744)
    at Traverser_Factory (angular-traversal.js:269)
    at _callFactory (core.js:30485)
    at _createProviderInstance (core.js:30428)

Mypackage.json

{
  "name": "angular",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.8",
    "@angular/common": "~8.2.8",
    "@angular/compiler": "~8.2.8",
    "@angular/core": "~8.2.8",
    "@angular/forms": "~8.2.8",
    "@angular/platform-browser": "~8.2.8",
    "@angular/platform-browser-dynamic": "~8.2.8",
    "@angular/router": "~8.2.8",
    "@plone/restapi-angular": "^2.0.0",
    "rxjs": "~6.4.0",
    "rxjs-compat": "^6.5.3",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.6",
    "@angular/cli": "~8.3.6",
    "@angular/compiler-cli": "~8.2.8",
    "@angular/http": "^7.2.15",
    "@angular/language-service": "~8.2.8",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }
}
ebrehault commented 4 years ago

The instructions on training.plone.org works for Angular 4. To install plone/restapi-angular on Angular 8, you cannot use the NPM package. You have to install missdev:

npm install -g mrs-developer

Then create a mrs.developer.json file containing:

{
    "angular-traversal": {
        "path": "/projects/traversal/src/lib",
        "url": "git@github.com:guillotinaweb/angular-traversal.git",
        "https": "https://github.com/guillotinaweb/angular-traversal.git",
        "branch": "master"
    },
    "plone.restapi-angular": {
        "package": "@plone/restapi-angular",
        "path": "/projects/plone-restapi-angular/src/lib",
        "url": "git@github.com:plone/plone.restapi-angular.git",
        "https": "https://github.com/plone/plone.restapi-angular.git",
        "branch": "master"
    }
}

then run:

missdev

It will checkout the master branch of plone/restapi-angular in your src/develop folder, and you should be good.

Note: we will update the plone/restapi-angular npm package soon I hope