Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error: Cannot find module 'tslib' #345

Closed
1 of 2 tasks
LukasHeimann opened this issue May 15, 2020 · 10 comments
Closed
1 of 2 tasks

[BUG] Error: Cannot find module 'tslib' #345

LukasHeimann opened this issue May 15, 2020 · 10 comments
Assignees
Labels

Comments

@LukasHeimann
Copy link

LukasHeimann commented May 15, 2020

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: 6668006#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)

@LukasHeimann
Copy link
Author

Minimal Working Example

Failure: https://github.com/LukasHeimann/fast-csv-bug --> just run npm i and node index.js
Working: https://github.com/LukasHeimann/fast-csv-bug/tree/working --> additionally imported tslib, though that should not be necessary in this very simple js-only project

@camillehe1992
Copy link

@LukasHeimann I met the same issue, and your solution works for me 👍thanks

@mannyvergel
Copy link

Also encountered this issue all of a sudden. Added tslib, but is there a way around this?

@EndersonPro
Copy link

@LukasHeimann Thanks, your solution work for me.

doug-martin added a commit that referenced this issue May 15, 2020
fix(): Fix for #345 remove revert to old tsconfig.build
@doug-martin
Copy link
Contributor

@LukasHeimann thank you for the bug report!

I have published a new version v4.1.5 which reverts the tsconfig changes. I apologize for the oversight.

I tested this out with a local repo and was able to run as expected. Let me know if you run into any more issues.

@LukasHeimann
Copy link
Author

@doug-martin Stuff like this happens... Thank you for fixing this so fast! :)

@troyschneringer
Copy link

I continue to see this issue when running my app in GAE. I've even tried to add tslib explicitly as a dependency. Got any advice on how to figure this one out?

@doug-martin
Copy link
Contributor

@troyschneringer what version is listed in your package-lock.json?

@troyschneringer
Copy link

dependency from package.json

"fast-csv": "^4.1.6"

relevant entries from yarn.lock

fast-csv@^4.1.6:
  version "4.1.6"
  resolved "https://registry.yarnpkg.com/fast-csv/-/fast-csv-4.1.6.tgz#a98fee885e492fd01aa618d61b59125d621b5c57"
  integrity sha512-Q6xhnJnsYws0Nr+P0KUbMBzrLIqdRjm5AsKkNffoK+/dDYikS73ybb3yroif/jRGRPK+6AtmrWgVi+dTelHdug==
  dependencies:
    "@fast-csv/format" "4.1.5"
    "@fast-csv/parse" "4.1.6"
    "@types/node" "^14.0.1"

"@fast-csv/format@4.1.5":
  version "4.1.5"
  resolved "https://registry.yarnpkg.com/@fast-csv/format/-/format-4.1.5.tgz#f4c21591f0b0cba728240dcb8b0caa7f28fd0f44"
  integrity sha512-SBwdUOJlFPvjlAuCxZeYrw5GGKdznXL/2PNldxewVNYVvM3r7yWix1N5Zrx1BpHYW/1J14k9An1fdWYNzt8zoQ==
  dependencies:
    lodash.escaperegexp "^4.1.2"
    lodash.isboolean "^3.0.3"
    lodash.isequal "^4.5.0"
    lodash.isfunction "^3.0.9"
    lodash.isnil "^4.0.0"

"@fast-csv/parse@4.1.6":
  version "4.1.6"
  resolved "https://registry.yarnpkg.com/@fast-csv/parse/-/parse-4.1.6.tgz#43575fbc4f528062ab7a6a903a60b908f3e36af9"
  integrity sha512-ThLkqP4jhrKBoMqWtJt1GdLWzG4ZO4+r1+hNtk/9H2eAiNFmhsBpanjudAV9Sz1iihai4iLRJ3Q68WPe1IgySA==
  dependencies:
    lodash.escaperegexp "^4.1.2"
    lodash.groupby "^4.6.0"
    lodash.isfunction "^3.0.9"
    lodash.isnil "^4.0.0"
    lodash.isundefined "^3.0.1"
    lodash.uniq "^4.5.0"

tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
  version "1.10.0"
  resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
  integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==

Stack Trace from GAE

A 2020-05-19T15:54:39.544231Z     '/workspace/dist/index.js' 
A 2020-05-19T15:54:39.544212Z     '/workspace/dist/src/app.js', 
A 2020-05-19T15:54:39.544200Z     '/workspace/dist/src/compositionRoot.js', 
A 2020-05-19T15:54:39.544187Z     '/workspace/dist/src/services/index.js', 
A 2020-05-19T15:54:39.544174Z     '/workspace/dist/src/services/reportService.js', 
A 2020-05-19T15:54:39.544160Z     '/workspace/node_modules/fast-csv/build/src/index.js', 
A 2020-05-19T15:54:39.544145Z     '/workspace/node_modules/@fast-csv/format/build/src/index.js', 
A 2020-05-19T15:54:39.544130Z   requireStack: [ 
A 2020-05-19T15:54:39.544116Z   code: 'MODULE_NOT_FOUND', 
A 2020-05-19T15:54:39.544100Z     at Function.Module._load (internal/modules/cjs/loader.js:899:14) { 
A 2020-05-19T15:54:39.544071Z     at Module.load (internal/modules/cjs/loader.js:1000:32) 
A 2020-05-19T15:54:39.544057Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) 
A 2020-05-19T15:54:39.544044Z     at Module._compile (internal/modules/cjs/loader.js:1156:30) 
A 2020-05-19T15:54:39.544029Z     at Object.<anonymous> (/workspace/node_modules/fast-csv/build/src/index.js:3:16) 
A 2020-05-19T15:54:39.543997Z     at require (internal/modules/cjs/helpers.js:77:18) 
A 2020-05-19T15:54:39.543986Z     at Module.require (internal/modules/cjs/loader.js:1042:19) 
A 2020-05-19T15:54:39.543973Z     at Function.Module._load (internal/modules/cjs/loader.js:899:14) 
A 2020-05-19T15:54:39.543958Z     at Module.load (internal/modules/cjs/loader.js:1000:32) 
A 2020-05-19T15:54:39.543942Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) 
A 2020-05-19T15:54:39.543926Z     at Module._compile (internal/modules/cjs/loader.js:1156:30) 
A 2020-05-19T15:54:39.543910Z     at Object.<anonymous> (/workspace/node_modules/@fast-csv/format/build/src/index.js:4:17) 
A 2020-05-19T15:54:39.543893Z     at require (internal/modules/cjs/helpers.js:77:18) 
A 2020-05-19T15:54:39.543878Z     at Module.require (internal/modules/cjs/loader.js:1042:19) 
A 2020-05-19T15:54:39.543862Z     at Function.Module._load (internal/modules/cjs/loader.js:862:27) 
A 2020-05-19T15:54:39.543844Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) 
A 2020-05-19T15:54:39.543825Z - /workspace/dist/index.js 
A 2020-05-19T15:54:39.543810Z - /workspace/dist/src/app.js 
A 2020-05-19T15:54:39.543797Z - /workspace/dist/src/compositionRoot.js 
A 2020-05-19T15:54:39.543783Z - /workspace/dist/src/services/index.js 
A 2020-05-19T15:54:39.543768Z - /workspace/dist/src/services/reportService.js 
A 2020-05-19T15:54:39.543748Z - /workspace/node_modules/fast-csv/build/src/index.js 
A 2020-05-19T15:54:39.543734Z - /workspace/node_modules/@fast-csv/format/build/src/index.js 
A 2020-05-19T15:54:39.543720Z Require stack: 
A 2020-05-19T15:54:39.543711Z Error: Cannot find module 'tslib' 

@troyschneringer
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants