SyntaxError: Unexpected identifier 'install'

Hello, dear forum members. I need your advice.
I need to run a script on Windows 10, but I can’t figure it out.
Python312, Node, npm are installed with the latest versions for today.

I perform the following sequence:

Step 1: Install Bitcoin Core

Step 2: Install Node JS

Step 3: Created a folder on the desktop “test”. In this folder, the program test and the script test_link2.js are saved to run

Here is the script:

#!/bin/bash
sudo apt update && sudo apt upgrade -y
sudo apt install nodejs -y
sudo apt install npm -y
npm install btc_core
npm install axios
echo “Script finished successfully.”
exit 0

Step 4: Open the PowerShell terminal as administrator. I go to the desired folder with the command:

cd C:\Users\adm\Desktop\test

I execute the command:
sudo node test_link2.js

The script does not run. I tried to run it without “sudo”, the result is the same.

If I’m not mistaken, the script is written for Linux. How can I run it without changes on Windows? Or how can I optimize it for Windows?

I tried to fix it myself. I removed 3 lines (I think they are not needed on Windows) and ran the script like this:

#!/bin/bash
npm install bitcoin_core
npm install axios
echo “Script finished successfully.”
exit 0

Gives a strange error (I’m attaching a photo of the error).

I would be grateful for any help. Thank you.

that is a bash script not a js script, node can’t execute it

Is it possible to run this script on Windows using js?

no, that script needs to be executed on a bash terminal, not powershell.

npm is node package manager, you can install those two things using npm directly without needing the script, if you have npm installed

Thank you. I’ll try.

I launch it separately

C:\Users\adm\Desktop\test>npm install bitcoin-core –save
up to date, audited 82 packages in 5s
4 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
C:\Users\adm\Desktop\test>npm install axios
up to date, audited 82 packages in 7s
4 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.

Do I understand correctly that if I run these lines, there is no need to run them in js?

npm is not JavaScript, you can’t run these in JavaScript.

Running these things without knowing what they are and what they do is not suggested. You can find our curriculum at https://www.freecodecamp.org/ to learn to code and even use npm for a full stack app