Menu

Showing posts with label Node JS. Show all posts
Showing posts with label Node JS. Show all posts

TypeError: body used already for url

Error: TypeError: body used already for endpoint url

The reason of this issue is, uses of statement response (e.g. reposne.json()) more than once. If we already use response body statment for reading the response data and try to use again response.json() statement anywhere else or in then function.

Solution: Create a variable and assign the fetch response into that variable as a value to further use. This way we need to call the response.json() statment only once. 

How to install older version of Node.JS and NPM

To install the older version of node.js use the below command. You could find the Node.js version here. https://nodejs.org/en/blog/release/

npm install -g node@14.19.0


To install the older version on npm in your machine use the below npm install command with specified version number. 

npm install -g npm@4.0.0

ExperimentalWarning: The ESM module loader is experimental

Node.js has two module systems: CommonJS modules and ECMAScript modules.
Authors can tell Node.js to use the ECMAScript modules loader via the .mjs file extension, the package.json "type" field, or the --input-type flag. Outside of those cases, Node.js will use the CommonJS module loader.

Error: Can't find Python executable "python", you can set the PYTHON env variable.

This error you are getting because npm need Python and your computer doesn't have Python install into it.
So please go ahead and install the Python in your machine, and run the npm install command after installing the Python. 

How to install python?

Go to the Python official website and download the latest release of Python, and simple install it.
Once installation has been successfully completed, then set the python variable in your machine environment variable. To know more, you could see our blog on How to set an environment variable in windows.

Or you could set the variable using this command.
npm config set python C:\Python\Python27\python.exe
If you don't wants to install Python manually and wants all things to be get downloaded by npm itself then you could run npm install -g windows-build-tools, this will download all the required dependencies for you and bring npm in working mode.
To run this command please make sure you have open your node command prompt and cmd with administrative privilege. To do so, go to start and search for node cmd and cmd >> then right click on the application shortcut and use the option run as administrator.
after that just copy and paste the command
npm install -g windows-build-tools

This command will download the Python and install the Python at the below directory in your machine. Go to this path and find the python.exe and set environment variable in CLASSPATH variable.
C:\Users\nodejs\.windows-build-tools\python27\