Hice un programa que funciona con éxito mientras ejecuto con node . Pero cuando instalé mi trabajo en el módulo global con npm i -g e intenté ejecutarlo con el shebang que especifiqué, recibí un error:
C:\Users\user_name\AppData\Roaming\npm\project_name.ps1:24:7 Line | 24 | & "usr/bin/env$exe" node "$basedir/node_modules/project_name … | ~~~~~~~~~~~~~~~~~ | The term 'usr/bin/env.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the | spelling of the name, or if a path was included, verify that the path is correct and try again.He probado a borrar los tres archivos que se crean y el propio módulo.
La primera línea en index.js tiene #!usr/bin/env node , mi paquete.json también tiene "bin": {"alias_for_the_project":"index.js},