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.

Getting error while importing axios-curlirize on ts + node

See original GitHub issue

Getting error while importing axios-curlirize,

ts-node ver. 9.1.1, typescript ver. 4.2.4

[ERROR] 14:27:26 Error: Must use import to load ES Module: node_modules/axios-curlirize/src/main.js
require() of ES modules is not supported.
require() of node_modules/axios-curlirize/src/main.js from temp.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename main.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from node_modules/axios-curlirize/package.json.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ShayBoxcommented, Oct 22, 2021

@ShayBox Created version 2.0.0 which makes use of ES Native Modules. Please use 1.3.7 for CommonJS. Version 1.4.0 has been deprecated in favour of using 1.3.7 or 2.0.0 depending on users’ need.

Thank you 👍

1reaction
ShayBoxcommented, Oct 3, 2021

This needed to be a major version change, switching to ES modules is a major breaking change, now everyone and every package depending on axios-curlirize 1.x.x^ will automatically use a broken update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error while importing axios-curlirize on ts + node #43
require() of node_modules/axios-curlirize/src/main.js from temp.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": " ......
Read more >
It give me error while importing axios from node module
You are using CommonJS. To import axios you could do const axios = require("axios");. Instead if you want to use ES Modules, you...
Read more >
axios-curlirize - npm Package Health Analysis - Snyk
Axios third-party module to print all axios requests as curl commands in the console. This repository is forked from axios-curlirize ...
Read more >
axios - npm search
Axios third-party module to print all axios requests as curl commands in the console ... and supports use with Node JS without having...
Read more >
Cannot find module 'axios' Error in TypeScript | bobbyhadz
To solve the "Cannot find module `axios` or its corresponding type declarations" error, install the module by running the command `npm install axios`....
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