novnc / noVNC

VNC client web application
https://novnc.com
Other
11.48k stars 2.28k forks source link

problem install on angular #1734

Closed djouf007 closed 1 year ago

djouf007 commented 1 year ago

Hello i have a problem when i want to install via npm install @novnc/novnc in my angular app

i have this error on my component when i want to import

Cannot find module '../../node_modules/@novnc/novnc/core/rfb.js

i readed this tutorial https://www.nasserboukehil.com/angular-vnc-client/

here is my code in my component ts

import RFB from "../../node_modules/@novnc/novnc/core/rfb.js";

public rfb: RFB;

  startClient() {
    console.log("Starting !!!");

    // Read parameters specified in the URL query string
    // By default, use the host and port of server that served this file
    const host = window.location.hostname;
    const port = "6080";
    const password = "foobar"; // password of your vnc server
    const path = "websockify";
    // Build the websocket URL used to connect
    let url = "ws";

    if (window.location.protocol === "https:") {
      url = "wss";
    } else {
      url = "ws";
    }

    url += "://" + host;
    if (port) {
      url += ":" + port;
    }
    url += "/" + path;

    console.log("URL: ", url);

    // Creating a new RFB object will start a new connection
    this.rfb = new RFB(document.getElementById("screen"), url, {
      credentials: { password: password },
    });
  }

this is my package.json

{
  "name": "neo",
  "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": "^15.0.3",
    "@angular/cdk": "15.0.2",
    "@angular/common": "^15.0.3",
    "@angular/compiler": "^15.0.3",
    "@angular/core": "^15.0.3",
    "@angular/forms": "^15.0.3",
    "@angular/material": "^15.0.2",
    "@angular/material-moment-adapter": "^15.0.2",
    "@angular/platform-browser": "^15.0.3",
    "@angular/platform-browser-dynamic": "^15.0.3",
    "@angular/router": "^15.0.3",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@novnc/novnc": "^1.3.0",
    "@types/quill": "^1.3.10",
    "chart.js": "^3.9.1",
    "chartjs-plugin-datalabels": "^2.1.0",
    "js-sha256": "^0.9.0",
    "moment": "^2.24.0",
    "ng2-charts": "^3.0.1",
    "ngx-color-picker": "^11.0.0",
    "ngx-cookie-service": "^15.0.0",
    "ngx-quill": "^20.0.0",
    "quill": "^1.3.7",
    "rxjs": "~7.5.0",
    "socket.io-client": "^4.5.4",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.3",
    "@angular/cli": "~15.0.3",
    "@angular/compiler-cli": "^15.0.0",
    "@fortawesome/fontawesome-free": "^5.15.4",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.2"
  }
}

thanks for your reply

CendioOssman commented 1 year ago

I see that you've also asked this in the discussion group, so I'll go ahead and close the issue here to avoid duplication.

001szymon commented 1 year ago

could we paste link to duplicate before closing the issue? @CendioOssman

eddgon88 commented 10 months ago

@CendioOssman where is the solution? I'm geting te same problem of @djouf007

samhed commented 10 months ago

Here's the other discussion, the reporter never responded:

https://groups.google.com/g/novnc/c/nAgp8uIjT-0/m/otCX8R5-BAAJ

001szymon commented 10 months ago

You need to have correct path to module

On Thu, Nov 30, 2023, 9:17 AM Samuel (ThinLinc team) < @.***> wrote:

Here's the other discussion, the reporter never responded:

https://groups.google.com/g/novnc/c/nAgp8uIjT-0/m/otCX8R5-BAAJ

— Reply to this email directly, view it on GitHub https://github.com/novnc/noVNC/issues/1734#issuecomment-1833294477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2MA6OKRJZMOFY5HJ34CHTYHA6IBAVCNFSM6AAAAAATJWO4ROVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZTGI4TINBXG4 . You are receiving this because you commented.Message ID: @.***>