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.

[BUG] Error: Cannot find module 'tslib'

See original GitHub issue

Describe the bug

Hi! First of all: Thank you for providing this great library. With the update to the latest patch version of fast-csv, I started to get some error messages when trying to import the library:

Error: Cannot find module 'tslib'
     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
     at Module.require (internal/modules/cjs/loader.js:692:17)
     at require (internal/modules/cjs/helpers.js:25:18)
     at Object.<anonymous> xxx/node_modules/@fast-csv/format/build/src/index.js:4:17)
     at Module._compile (internal/modules/cjs/loader.js:778:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
     at Module.load (internal/modules/cjs/loader.js:653:32)
     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
     at Function.Module._load (internal/modules/cjs/loader.js:585:3)

I assume, this is down to the following change in your tsconfig: https://github.com/C2FO/fast-csv/commit/666800653811b54bd32c5afb59b9ef146ac7828e#diff-17d19956339a21e53394cda05f5a6cc3R9

You added "importHelpers": true which will (as I found out) Import emit helpers from 'tslib'. Yet, tslib is not defined as a dependency, so I assume this compiler option emits some code that fails at runtime if the dependency is not present.

Parsing or Formatting?

  • Formatting
  • Parsing

To Reproduce

I’ll update with a mwe, currently building one

Expected behavior

Importing the library should be possible without having to require tslib myself explicitly.

Desktop (please complete the following information):

  • OS: Windows
  • OS Version 10
  • Node Version 10.18.1

(But also my Jenkins, which runs on Linux, but I don’t know exact version there)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
troyschneringercommented, May 19, 2020

Looks like I may have been running into a caching issue with GAE and node. Running

gcloud beta app deploy --no-cache

solved the issue for me on version 4.2.0. Thanks for your quick responses and fixes.

1reaction
LukasHeimanncommented, May 18, 2020

@doug-martin Stuff like this happens… Thank you for fixing this so fast! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module "tslib" - angular - Stack Overflow
The issue is that if you accidentally import something from '@angular/compiler/src/util' you may get this warning when you build "Critical ...
Read more >
Cannot find module "tslib" #11469 - angular/angular-cli - GitHub
To solve the problem, I returned the owner and group from the node_modules folder to mine, and it worked.
Read more >
Uncaught Error: Cannot find module "tslib" when update to 3.9.2
I uninstalled angular/cli and install it again. update npm; remove node_module folder; npm install. Now, It is working. :wink: 1 Like.
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 >
error: cannot find module 'typescript/package.json'
Depending on configuration, you may also need these npm install -D tslib @types/node 12.
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