Rich-Harris / degit

Straightforward project scaffolding
MIT License
6.95k stars 243 forks source link

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

Open xywang68 opened 3 years ago

xywang68 commented 3 years ago
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.

abannsunny commented 3 years ago

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

Giving a bit more context:

Stumbled upon similar issue: https://github.com/domenic/worm-scraper/issues/5#issuecomment-321033496

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

alsotang commented 3 years ago

the same problem happened to me

nashaad commented 3 years ago

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
keshprad commented 3 years ago

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

gwelr commented 3 years ago

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.

AlexMercedCoder commented 3 years ago

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 :).

kazuma1989 commented 3 years ago

@Rich-Harris Thank you for quick fixes!

Now v2.8.4 works fine 🎉

AlexMercedCoder commented 3 years ago

YES, Thank you!