最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - npx and scoped packages - Stack Overflow

programmeradmin3浏览0评论

I'm trying to understand how this Node.js command works:

npx @11ty/eleventy

From what I understood, it looks like npx first goes into node_modules/@11ty/eleventy and finds the package.json file. More specifically, it looks for this part:

"bin": {
  "eleventy": "cmd.cjs"
}

Now, I tried changing the key from "eleventy" to "hey" and now when running npx @11ty/eleventy I got this error:

sh: hey: command not found

"sh" probably indicates this comes from the shell, which probably means that "npx" tried to find this executable inside node_modules/.bin, but couldn't find it.

How did "npx" decide to execute hey in the first place? I don't quite understand how the matching algorithm works when it comes to npx and scoped packages. Tried looking it up everywhere but couldn't find any documentation on this.

发布评论

评论列表(0)

  1. 暂无评论