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.

'long' import error

See original GitHub issue

Problem description

The latest version 0.6.10 has error with importing ‘long’, and as a result I can not compile. Error log comes like this.

node_modules/@grpc/proto-loader/build/src/index.d.ts:22:10 - error TS2617:  'Long' can only be imported by using 'import Long = require("long")' or by turning on the 'esModuleInterop' flag and using a default import.

22 export { Long } from 'long';

Reproduction steps

I can compile with dependency below.

    "@grpc/proto-loader": {
      "version": "0.6.9",
      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.9.tgz",
      "integrity": "sha512-UlcCS8VbsU9d3XTXGiEVFonN7hXk+oMXZtoHHG2oSA1/GcDP1q6OUgs20PzHDGizzyi8ufGSUDlk3O2NyY7leg==",
      "requires": {
        "@types/long": "^4.0.1",
        "lodash.camelcase": "^4.3.0",
        "long": "^4.0.0",
        "protobufjs": "^6.10.0",
        "yargs": "^16.2.0"
      }
    },

I cannot compile with dependency below.

    "@grpc/proto-loader": {
      "version": "0.6.10",
      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.10.tgz",
      "integrity": "sha512-TM2ghLt8pchK+XAlytMJ7RQvSqAb75c8kdizk6PuscNOT8aLYUL/CWESGLvp5GiDsWb6Gzs/VEen1M0e43ggZw==",
      "optional": true,
      "requires": {
        "@types/long": "^4.0.1",
        "lodash.camelcase": "^4.3.0",
        "long": "^5.2.0",
        "protobufjs": "^6.10.0",
        "yargs": "^16.2.0"
      }
    },

Environment

  • MacOS Big Sur
  • node version: 14.17.3
  • Node installation method : nvm

Additional context

I had been building without any problem until yesterday. The error came out today.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
murgatroid99commented, May 3, 2022

This should be fixed in 0.6.11. If you have a dependency on long version 4, proto-loader will use it instead of installing long version 5.

2reactions
lovellcommented, May 3, 2022

There’s an upstream issue at https://github.com/dcodeIO/long.js/issues/109 that suggests upgrading long from v4 to v5 might be a breaking-breaking change for TypeScript users.

(This issue is affecting the downstream google-gax package and therefore much of the @google-cloud/... package ecosystem.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

6 Common CSV Import Errors and How to Fix Them
Discover the top 6 most common CSV import errors that companies ... These include unexpected data length – either too long or too...
Read more >
Fixing Import Errors: STRING_TOO_LONG
This means that the field you are attempting to import into has a character limit and the value you are attempting to import...
Read more >
Handle import errors - Analytics Help
Troubleshoot Data Import problems.Not seeing the imported data appearing in your reports, as expected? This article can help you troubleshoot the problem.
Read more >
MySQL import csv is failing with Data too long for column ...
When I'm trying to import csv into MySQL table, I'm getting an error. Data too long for column 'incident' at row 1.
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
These files represent how the ImportError occurs when there is a circular dependency between them, leading to a dead loop situation.
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