Rich-Harris/degit

npx degit failed due to missing #!/usr/bin/env node line

xywang68 opened this issue · 8 comments

npx degit https://github.com/xyteam/autobdd-test.git#main autobdd-test
npx: installed 1 in 0.681s
/home/xywang68/.npm/_npx/805/bin/degit: 1: use strict: not found
/home/xywang68/.npm/_npx/805/bin/degit: 3: Syntax error: "(" unexpected

npm install degit and npm install degit and added line:

#!/usr/bin/env node

to bin/degit solve the problem.

faced the same issue solved it exactly as @xywang68 mentioned.

Giving a bit more context:

Stumbled upon similar issue:
domenic/worm-scraper#5 (comment)

Stack overflow answer
https://stackoverflow.com/a/34354713

the same problem happened to me

Install degit npm install -g degit

Edit degit, add this line #!/usr/bin/env node at the top of the file

nano /usr/local/bin/degit

I'm also getting the same issue. I did the same thing @nashaad did and it works for me.

gwelr commented

Had the same issue today (was working fine two days ago).
I noticed I was not using the latest npx version, so I upgraded npm 7.7.6.

As proposed above, I edited degit script and added the following line at the top of the file:

#!/usr/bin/env node

It fixed the issue. I'm on ubuntu 20.04.

Yeah I was teaching a class which I guess was 30 minutes after the update and had the same issue with all my students. Turned it into an impromptu lesson on reading github issues (then they just cloned the starter code). Sounds like a quick fix so hopefully the Saturday class will go smoother :).

YES, Thank you!