Closed Ari-H closed 2 years ago
To add that I've encountered this as well, and that module that is being rewired doesn't have to be the one with the shebang.
Node 12.15.0 is ok, but 12.16.x has the failure. Rewire 4.0.1 also will fail.
Great to see a fix yesterday @jhnns - do you have an expected re-release date?
hi, came across this bug when I was debugging a similar issue with Electron. I filed this Node bug https://github.com/nodejs/node/issues/36173. I suspect you are running into the same thing because rewire
monkey-patches Module.wrapper
.
for us it breaks loading plant-uml package to auto-generate uml images while running jsdoc... No nice images anymore in docs, just a sea of gray :-(
Has this been fixed? 'Cause it just happened with node 16.10.0, typescript ^4.0.3 and rewire ^5.0.0 😞
; (function () { #!/usr/bin/env node
^
SyntaxError: Invalid or unexpected token
@cope there is a PR for this, but it's never been merged.
We abandoned using this module. It doesn't appear to be maintained any longer
@mbwhite thanks for the info
is there an alternative to use?
Using rewire@5.0.0. Modules including shebang line can no longer be loaded with rewire.
Files to test the issue:
With Node.js 12.15.0 it still works:
Starting with Node.js 12.16.0 it fails:
There has been some changes on shebang handling in Node.js 12.16.0: https://github.com/nodejs/node/commit/bcd27f7300 https://github.com/nodejs/node/commit/1c50714729