'globally installed npm packages not working

I'm having problems using globally installed npm packages. I have confirmed they are installed by using

npm list -g --depth=0

npm bim -g shows C:\Users\Acer\AppData\Roaming\npm

I am on windows 10.

EDIT:

my npm version is 6.14.15,my node.js version is 16.13.1. When i download a package from npm, let's say:

npm install nexe -g

the download works. it installs the package in

C:\Users\Acer\AppData\Roaming\npm. i can confirm that by running

npm list -g --depth=0.

When i want to use any globally installed packages (for example nexe index.js), I get the message

C:\Users\Acer\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

What do? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source