question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version

"@tensorflow/tfjs-node": "^1.2.9",

Browser version

Google Chrome Version 77.0.3865.90 (Official Build) (64-bit)

Describe the problem or feature request

30 09 2019 10:51:32.313:INFO [launcher]: Launching browsers Chrome_no_sandbox with concurrency unlimited
30 09 2019 10:51:32.319:INFO [launcher]: Starting browser ChromeHeadless
                                                                                          
ERROR in node_modules/@tensorflow/tfjs-core/dist/backends/webgl/canvas_util.d.ts(19,61): error TS2304: Cannot find name 'OffscreenCanvas'.

Code to reproduce the bug / link to feature request

Angular project with Karma and puppeteer:

const process = require("process");
process.env.CHROME_BIN = require("puppeteer").executablePath();

module.exports = function (config) {
  config.set({
    basePath: "",
    frameworks: ["jasmine", "@angular-devkit/build-angular"],
    plugins: [
      require("karma-jasmine"),
      require("karma-chrome-launcher"),
      require("karma-jasmine-html-reporter"),
      require("karma-coverage-istanbul-reporter"),
      require("@angular-devkit/build-angular/plugins/karma")
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require("path").join(__dirname, "../coverage"),
      reports: ["html", "lcovonly"],
      fixWebpackSourcePaths: true,
      thresholds: {
        statements: 100,
        lines: 100,
        branches: 100,
        functions: 100
      }
    },
    reporters: ["progress", "kjhtml"],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: false,
    browsers: ["Chrome_no_sandbox"],
    customLaunchers: {
      Chrome_no_sandbox: {
        base: "ChromeHeadless",
        flags: [
          "--no-sandbox",
          "--proxy-bypass-list=*",
          "--proxy-server='direct://'"
        ]
      }
    },
    concurrency: Infinity,
    singleRun: true
  });
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
khodjabekovacommented, Nov 6, 2019

@zzj0402 I installed "@tensorflow/tfjs": "^1.3.1", imported it as usual import * as tf from '@tensorflow/tfjs'; and run. Then I got error ERROR in node_modules/@tensorflow/tfjs-core/dist/backends/webgl/canvas_util.d.ts(20,61): error TS2304: Cannot find name 'OffscreenCanvas'.

I found solution here but I don’t think that is a best way modifying lib.dom.d.ts file

1reaction
djimoh5commented, Nov 23, 2019

I tried installing @types/offscreencanvas. Then when navigating to the file @tensorflow/tfjs-core/dist/backends/webgl/canvas_util.d.ts, Typescript is able to recognize OffscreenCanvas, but for some reason the build still cannot.

So my workaround was just to change the type in the offending line from OffscreenCanvas to “any”

Old: export declare function createCanvas(webGLVersion: number): OffscreenCanvas | HTMLCanvasElement;

New: export declare function createCanvas(webGLVersion: number): any;

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript getting error TS2304: cannot find name ' require'
I am trying to get my first TypeScript and DefinitelyTyped Node.js application up and running, and running into some errors. I am getting...
Read more >
TS2304: Cannot find name 'Request' · Issue #661 - GitHub
When compiling a Typescript file that uses MeiliSearch for Node.js, the error TS2304: Cannot find name 'Request' causes the build to fail.
Read more >
TypeScript error TS2304 cannot find name require - Edureka
The error that I'm getting is the "TS2304: Cannot find name 'require' " when I attempt to transpile a simple TypeScript Node.js page....
Read more >
Typescript getting error TS2304 cannot find name ' require'
When we try to get a TypeScript running, we get this error: "TS2304: Cannot find name 'require' " when we attempt to transpile...
Read more >
error TS2304 Cannot find name 'IterableIterator' - YouTube
error TS2304 Cannot find name 'IterableIterator' - Typescript error when converting ts to js. 2.2K views 2 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found