Axios doesn't load

I have the following line of code in my node program that doesn’t work:

const axios = require(‘axios’);

I get the error:

require.js:168 Uncaught Error: Module name “axios” has not been loaded yet for context: _. Use require()

I ran the commands:

yarn add axios
npm install axios --save -g

but it still doesn’t find the module.

And when I try to get the version number with >axios -v, I get the error:
‘axios’ is not recognized as an internal or external command,
operable program or batch file.

Screenshot from 2020-03-14 22-18-10

Hi @makamo661, it seems that something in that line is getting rendered as a square icon here – could you format that line as code to prevent his? But why are you using require.js in a node context in the first place?

Axios probably doesn’t expose any executables, so this will indeed not work. What do you get when you just require('axios') from the node REPL though?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.