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.

Cannot find name 'global' when trying to import in Angular

See original GitHub issue

Trying to import via:

import * as tinify from 'tinify'

But getting: ERROR in node_modules/tinify/lib/tinify/Error.d.ts(1,36): error TS2304: Cannot find name 'global'.

Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
simonwahlstromcommented, Feb 15, 2019

Hi there,

Angular is a front-end framework. This is a NodeJS library and you need to use it server side (back-end). Unfortunately the API does not support being used in the front-end (like Angular does). The reason being that it would make it hard to hide sensitive data from the user (like you API key).

In short, this will not be usable with just Angular. You would need a back-end to handle the compressions. What I would recommend is posting the image from your Angular application to the server and have the server import Tinify and deal with the compression. You can then return the compressed image to the Angular application if you want to give it back to the user.

Hope this clears up the issue!

0reactions
markmakescommented, Feb 15, 2019

Thanks Simon, understood about this intending for strictly backend node use. We were trying to see if we could convert the node version into a front-end usable component (we’ve actually done that in the past with other plugins).

Either way, appreciate the response!

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular 2 webpack 2 error cannot find name 'global'
Have you tried setting: typings.d.ts //If you don't see this file under src folder create one. With: declare var global: any.
Read more >
Cannot find name 'require' Error in TypeScript | bobbyhadz
To solve the "Cannot find name require" error, install the node types by running npm i -D @types/node . If the error is...
Read more >
$localize Global Import Migration - Angular
This package requires a global $localize symbol to exist. ... If this import is missing, you will see an error message like this:....
Read more >
TypeScript configuration - Angular
A given Angular workspace contains several TypeScript configuration files. At the root tsconfig.json file specifies the base TypeScript and Angular compiler ...
Read more >
NG0301: Export not found! - Angular
Angular can't find a directive with {{ PLACEHOLDER }} export name. The export name is specified in the exportAs property of the directive...
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