Skip to content

If yarn is not installed, npm create @metamask/snap my-first-snap causes Error: Init Error: Failed to install dependencies. #1477

@vorburger

Description

@vorburger

For ChainSafe/filsnap#258 :

https://docs.metamask.io/snaps/get-started/quickstart/

as well as https://docs.metamask.io/snaps/get-started/install-snaps/

mention npm or yarn. I'm in a noob in this space, and initially had only NPM but not Yarn installed on my system,

and when I first did as the documentation instructs one to, it didn't work:

$ npm create @metamask/snap my-first-snap
Need to install the following packages:
  @metamask/[email protected]
Ok to proceed? (y) y
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: This project has moved to @types/webextension-polyfill
npm WARN deprecated [email protected]: This project has moved to @types/webextension-polyfill
Preparing /home/vorburger/git/github.com/vorburger/LearningMetaMaskSnap/my-first-snap...
Cloning template...
Installing dependencies...
/bin/sh: line 1: yarn: command not found
/home/vorburger/.npm/_npx/93b2e831f912ce78/node_modules/@metamask/create-snap/dist/cmds/init/initUtils.js:118
        throw new Error('Init Error: Failed to install dependencies.');
              ^

Error: Init Error: Failed to install dependencies.
    at yarnInstall (/home/vorburger/.npm/_npx/93b2e831f912ce78/node_modules/@metamask/create-snap/dist/cmds/init/initUtils.js:118:15)
    at initHandler (/home/vorburger/.npm/_npx/93b2e831f912ce78/node_modules/@metamask/create-snap/dist/cmds/init/initHandler.js:50:33)
    at async Object.init [as handler] (/home/vorburger/.npm/_npx/93b2e831f912ce78/node_modules/@metamask/create-snap/dist/cmds/init/index.js:27:5)

Node.js v18.16.0
npm ERR! code 1
npm ERR! path /home/vorburger/git/github.com/vorburger/LearningMetaMaskSnap
npm ERR! command failed
npm ERR! command sh -c create-snap my-first-snap

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vorburger/.npm/_logs/2023-06-04T21_43_23_531Z-debug-0.log

I'm new to this space, but ... if one needs Yarn anyway, and it doesn't "just work" having only NPM, then...

... what's the point documenting both? Wouldn't it be simpler and less confusing to only mention Yarn directly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions