johannschopplich / kirbyup

🆙 Official bundler for Kirby Panel plugins
https://kirbyup.getkirby.com
MIT License
51 stars 3 forks source link

npx "Repository not found" error #5

Closed moritzebeling closed 3 years ago

moritzebeling commented 3 years ago

Hi, thank you for this package! Since a few days and on several machines I run into the following error:

  1. When I run npm run dev, I get the following error:
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t ssh://git@github.com/src/index.js.git
npm ERR! ERROR: Repository not found.
npm ERR! exited with error code: 128
My `package.json` looks exactly like the one from the instructions
{
  "scripts": {
    "dev": "npx -y kirbyup src/index.js --watch",
    "build": "npx -y kirbyup src/index.js"
  }
}
  1. When I run npx kirbyup src/index.js --watch directly everything works as expected
  2. When I run npx -y kirbyup src/index.js --watch I get the same error as above. So maybe it is the -y flag that is causing the error?

The error description looks like if the code tries to assess the ssh://git@github.com/src/index.js.git repo, which looks incorrect...

johannschopplich commented 3 years ago

Seems like this is a npx problem, specific to Windows. You're using Windows, right? Which Node and npm version? Unfortunately, I don't have a fix, since the bug isn't part of kirbyup itself.

To prevent security and user-experience problems from mistyping package names, npx prompts before installing anything. The -y or --yes option just prevents this "do you want to install this package" prompt.

Please use the following package.json instead:

{
  "scripts": {
    "dev": "kirbyup src/index.js --watch",
    "build": "kirbyup src/index.js"
  },
  "devDependencies": {
    "kirbyup": "^0.17.1"
  }
}
moritzebeling commented 3 years ago

Thank you for getting back! I use Mac Big Sur, Node 14.17 and NPM 6.14.

Your setup is missing the npx at the beginning of both commands, but otherwise works! Thanks!

{
  "scripts": {
    "dev": "npx kirbyup src/index.js --watch",
    "build": "npx kirbyup src/index.js"
  },
  "devDependencies": {
    "kirbyup": "^0.17.1"
  }
}
johannschopplich commented 3 years ago

I see. How unfortunate the Git error is present on macOS as well...

As stated in the readme's requirements:

ℹ️ When using kirbyup with npx, npm 7+ is required. Previous versions don't pass CLI arguments to the package invoked. npm 7 is bundled from Node 16 onwards.

The setup posted above works as expected. Using npx in conjunction with npm install would defeat the intrinsic purpose of npx. However, if you use npx you can drop the dev dependencies package key all together.

Glad to hear it's working now!