degit icon indicating copy to clipboard operation
degit copied to clipboard

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

Open xywang68 opened this issue 3 years ago • 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.

xywang68 avatar Apr 01 '21 01:04 xywang68

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

abannsunny avatar Apr 01 '21 03:04 abannsunny

the same problem happened to me

alsotang avatar Apr 01 '21 03:04 alsotang

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

nashaad avatar Apr 01 '21 04:04 nashaad

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

keshprad avatar Apr 01 '21 06:04 keshprad

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.

gwelr avatar Apr 01 '21 12:04 gwelr

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

AlexMercedCoder avatar Apr 01 '21 13:04 AlexMercedCoder

@Rich-Harris Thank you for quick fixes!

  • https://github.com/Rich-Harris/degit/commit/07222570613a5326db11269c2f8dc0324add765f#diff-f9469b2caca44d79b8f2f7c81296a7b2bf9b19e25fb3e1450b9f4f3bf4117e2b
  • https://github.com/Rich-Harris/degit/commit/64b80577acf3313b669840f7452800ee8d09fbf3#diff-f9469b2caca44d79b8f2f7c81296a7b2bf9b19e25fb3e1450b9f4f3bf4117e2b

Now v2.8.4 works fine 🎉

kazuma1989 avatar Apr 01 '21 22:04 kazuma1989

YES, Thank you!

AlexMercedCoder avatar Apr 01 '21 23:04 AlexMercedCoder