admin管理员组文章数量:1196992
I have a project that I am using yarn
for. I've installed all my packages using yarn
, I run yarn dev
and so on. Now I'm following a tutorial that requires me to use npx
to set up a package. - I'm wondering if I can just go ahead with this or if I will end up mixing things up here, as npx
, as far as I know, is related to npm
?
I have a project that I am using yarn
for. I've installed all my packages using yarn
, I run yarn dev
and so on. Now I'm following a tutorial that requires me to use npx
to set up a package. - I'm wondering if I can just go ahead with this or if I will end up mixing things up here, as npx
, as far as I know, is related to npm
?
1 Answer
Reset to default 24Yes. npx
will run the executable from your node_modules
directory if it is installed there. If it is not, it will install the executable into a different location. It will not interfere with yarn
operations.
With Yarn 2, you can also use dlx
. For example:
yarn dlx create-react-app ./my-app
See https://yarnpkg.com/cli/dlx for information and options.
本文标签: javascriptCan I use NPX with yarnStack Overflow
版权声明:本文标题:javascript - Can I use NPX with yarn? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738479473a2089057.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
npx
does nothing more than invoking a script on anpm
repository (which yarn also uses) without actually installing it (globally). It can be used interchangeable with yarn. – nbokmans Commented Sep 27, 2021 at 11:28instead of
but alsowith it
? as in: can I today install everything withyarn
, tomorrow use annpx
command and then next week useyarn add xxx
again? – antonwilhelm Commented Sep 27, 2021 at 11:30npx
fornpx eslint init
. It created apackage-lock.json
(along with other configs and added dependencies), then I deleted thepackage-lock.json
and ranyarn
after to properly install. Seems like it worked without any problems. – user3773048 Commented Sep 28, 2021 at 19:34