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.

module 'tslib' cannot be found

See original GitHub issue

Hi guys. I’m getting this error when I run `node_modules/.bin/tsc’ in the following folder.

error TS2354: This syntax requires an imported helper but module ‘tslib’ cannot be found.

The offending line (rxjs/Subscriber.d.ts(13,36) does indeed include an innocent looking extend keyword. Can you tell me what I’m doing wrong?

$ node_modules/.bin/tsc
node_modules/rxjs/Subscriber.d.ts(13,36): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

src/main.ts

import { Observable } from "rxjs";

Observable.timer(3000, 5000)
  .timeInterval()
  .subscribe((interval) => console.log(interval));

tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "importHelpers": true,
    "target": "es5",
    "noEmitHelpers": true
  }
}

package.json

{
  "name": "stuff",
  "version": "1.0.0",
  "scripts": {
    "build": "webpack"
  },
  "devDependencies": {
    "@types/core-js": "^0.9.35",
    "ts-loader": "^1.3.2",
    "typescript": "^2.1.4",
    "webpack": "^2.1.0-beta.25"
  },
  "dependencies": {
    "rxjs": "^5.0.1",
    "tslib": "^1.2.0"
  }
}

rxjs/Subscriber.d.ts(13)

export declare class Subscriber<T> extends Subscription implements Observer<T> {

I posted my question to stackoverflow but can’t get any interest

Issue Analytics

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

github_iconTop GitHub Comments

20reactions
tony2tonescommented, May 7, 2019

try npm install --save tslib, thats what helped me out.

3reactions
mhegazycommented, Dec 15, 2016

We should be publishing 2.1.5 with he fix soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"This syntax requires an imported helper but module 'tslib ...
9. After updating to Ng12, with tslib already installed and getting This syntax requires an imported helper but module 'tslib' cannot be found....
Read more >
TypeScript error “TS2354: This syntax requires an ... - GitHub
js:3:8 - error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found. 3 const {ArgumentParser} = require('argparse') ...
Read more >
This syntax requires an imported helper but module 'tslib ...
To solve the error "This syntax requires an imported helper but module 'tslib' cannot be found", install tslib by running npm install -D...
Read more >
tslib - npm
This is a runtime library for TypeScript that contains all of the TypeScript helper functions. This library is primarily used by the -- ......
Read more >
How to fix Visual Studio throwing a "This syntax requires an ...
Fixing “This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib ...
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