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.

Move to "import" broke things

See original GitHub issue

typescript compiles fine, but I get these errors when I run. I am not willing to change package.json to make this work.

node:internal/modules/cjs/loader:1109
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/mesoic/Desktop/chainlink/node-operator-management/pegswap/node_modules/log-symbols/index.js
require() of ES modules is not supported.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
trobert2commented, May 18, 2021

I don’t think this issue should have been closed.

After reading the release notes we get:

This package is now pure ESM. Please read this. After following the link we get to https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

even after following the instruction there, I could not get my package to work as ESM. Even if one can afford to completely re-vamp their project and move away from CommonJS and assuming all the libraries you have work with the change (not all will), there are cases where this does not work. If you are using this tool to build a CLI for example, then new package won’t be installed as an executable when using -g.

I think at least bug fixes should be ported to v4 as it works with CommonJS. I ended up installing "log-symbols": "4.1.0"

0reactions
xeroxstarcommented, Dec 16, 2021

When I am trying to import ‘log-symbols’: import logSymbols from 'log-symbols';

I am getting an error:

import chalk from ‘chalk’; ^^^^^^

SyntaxError: Cannot use import statement outside a module

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repaired Goods: Import and Reexport - Shipping Solutions
Contact your broker and discuss the steps you and your customer should take to import the goods for repair. This will lay the...
Read more >
Importing into the United States A Guide for Commercial ...
Imported goods are not legally entered until after the shipment has arrived within the port of entry, delivery of the merchandise has been...
Read more >
Traps for the Unwary in Python's Import System
Even though 3.3 cleaned up a lot of things, it still has to deal with ... to broken imports (either failing to find...
Read more >
Importing Packages in Go - DigitalOcean
This program first imports the math/rand package on the third line, then moves into a for loop which that will run 10 times....
Read more >
VSCode: Could not import Golang package - Stack Overflow
Make sure your tools are up to date: run ctrl + shift + p , type Go and chose Install/Update tools . Try...
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