Rich-Harris / degit

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

Cannot install this package with npm gloablly #273

Open seanlawrenz opened 3 years ago

seanlawrenz commented 3 years ago

npm i -g degit throws an enoent ENOENT: no such file or directory, chmod '/Users/me-as-a-user/.nvm/versions/node/v14.15.1/lib/node_modules/degit/bin.js'

Like that's the file you're installing...

Happens even with sudo. Literally can install globally any other package in the world except this one.

manuel3108 commented 3 years ago

For everyone trying around, this seems to be a valid work-around:

npx degit@2.8.0 "sveltejs/sapper-template#rollup" my-app

Edit: Tried to find the commit that breaks this, but I cannot find one. This commit seems the only to be modifying the package.json: https://github.com/Rich-Harris/degit/commit/4fe3594cdfafc122d51d58acf3dcd42ab81daaef

bmehder commented 3 years ago

For everyone trying around, this seems to be a valid work-around:

npx degit@2.8.0 "sveltejs/sapper-template#rollup" my-app

I was able to download the template, but I am not able to run "npm run dev". I get "npm ERR! missing script: dev". I will wait for a bit and try again.

manuel3108 commented 3 years ago

For everyone trying around, this seems to be a valid work-around:

npx degit@2.8.0 "sveltejs/sapper-template#rollup" my-app

I was able to download the template, but I am not able to run "npm run dev". I get "npm ERR! missing script: dev". I will wait for a bit and try again.

Mhm, just tried it and it seems to be working for me. So I guess that's another thing

dominikg commented 3 years ago

bin.js and index.js from package root are missing in 2.8.1

rafaelsorto commented 3 years ago

For the moment just specify degit@2.8.0 and it works

npx degit@2.8.0 sveltejs/template svelte-components

Rich-Harris commented 3 years ago

Don't really understand how this happened but it should be fixed in 2.8.2

jcmonnin commented 3 years ago

I still get issues in degit 2.8.2 (on archlinux)

$ npx degit sveltejs/template my-svelte-project
/home/jean-claude/.npm/_npx/ca8ac1ce5606ff91/node_modules/.bin/degit: line 1: use strict: command not found
/home/jean-claude/.npm/_npx/ca8ac1ce5606ff91/node_modules/.bin/degit: line 3: syntax error near unexpected token `('
/home/jean-claude/.npm/_npx/ca8ac1ce5606ff91/node_modules/.bin/degit: line 3: `var fs = require('fs');'

Downgrading to 2.8.0 works

$ npx degit@2.8.0 sveltejs/template my-svelte-project
> cloned sveltejs/template#master to my-svelte-project

Version 2.8.0 had a index.js (doing module.exports = require('./dist');) and bin.js (doing require('./dist/bin.js');). This is bypassed in 2.8.2; the files property doesn't include them anymore. The fix in 2.8.2 might be wrong.

Diff of package.json image

Rich-Harris commented 3 years ago

Gah, sorry — try 2.8.4!

jcmonnin commented 3 years ago

Thanks, all ok with 2.8.4