aerogear / create-graphql

Command-line utility to build production-ready servers with GraphQL.
MIT License
440 stars 38 forks source link

/bin/sh: yo: command not found #74

Closed katopz closed 7 years ago

katopz commented 7 years ago

Somehow I got this error on my macOS

$ create-graphql generate --mutation Awesome
✗ GraphQL CLI requires Yeoman to be installed.
✓ Yeoman installed!
/bin/sh: yo: command not found
(node:37016) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with status 127
(node:37016) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

FYI

$ node --version
v7.4.0

Any hint?

lucasbento commented 7 years ago

Hmm, how did you install create-graphql on the first place? Using yarn or npm?

Can you check if yo (yeoman) is installed on your machine?

katopz commented 7 years ago

Oh! it work after I manually npm install -g yo (I use npm way) At first I think ✓ Yeoman installed! should install yeoman for me already like it said. 🤕

lucasbento commented 7 years ago

That's what it is supposed to do, it actually just trigger a npm install -g yo while you are trying to generate a file.

Do you have yarn installed? If you do, what version is it?

katopz commented 7 years ago

Somehow yes but I rarely use it, it's 0.17.10

felippepuhle commented 7 years ago

Maybe the path variable isn't being updated?

lucasbento commented 7 years ago

The problem is probably with yarn itself, since it is already on version 0.19.1.

create-graphql checks if you have yarn installed, if you do, it uses it, otherwise it goes with npm.

Perhaps it's better to remove that checking for now and go with npm only, what do you guys think?

katopz commented 7 years ago

I think I mess thing up already when try to uninstall yarn

cat:mongoose-role-example katopz$ yarn --version
0.17.10
cat:mongoose-role-example katopz$ npm r -g yo
- abbrev@1.1.0 node_modules/yo/node_modules/abbrev
...
- yo@1.8.5 node_modules/yo
cat:mongoose-role-example katopz$ create-graphql generate --type Awesome
✗ GraphQL CLI requires Yeoman to be installed.
✓ Yeoman installed!
/bin/sh: yo: command not found
(node:9879) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with status 127
(node:9879) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cat:mongoose-role-example katopz$ brew uninstall yarn
Uninstalling /usr/local/Cellar/yarn/0.17.10... (5,638 files, 18.2M)
cat:mongoose-role-example katopz$ yarn --version
-bash: /usr/local/bin/yarn: No such file or directory
cat:mongoose-role-example katopz$ create-graphql generate --type Awesome
✗ GraphQL CLI requires Yeoman to be installed.
✗ There was an error while trying to install Yeoman: { Error: Exited with status 127
    at closeArgsToError (/usr/local/lib/node_modules/create-graphql/node_modules/cross-spawn-promise/lib/index.js:20:16)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/create-graphql/node_modules/cross-spawn-promise/lib/index.js:76:19)
    at Object.onceWrapper (events.js:290:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
  exitStatus: 127,
  stdout: null,
  stderr: <Buffer 2f 62 69 6e 2f 73 68 3a 20 79 61 72 6e 3a 20 63 6f 6d 6d 61 6e 64 20 6e 6f 74 20 66 6f 75 6e 64 0a> }
/bin/sh: yo: command not found
(node:10109) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with status 127
(node:10109) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cat:mongoose-role-example katopz$ npm install --global create-graphql
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/bin/create-graphql -> /usr/local/lib/node_modules/create-graphql/bin/create-graphql

> create-graphql@1.1.12 postinstall /usr/local/lib/node_modules/create-graphql
> npm i -g generator-graphql

/usr/local/lib
└── generator-graphql@1.1.15 

/usr/local/lib
└── create-graphql@1.1.12 
cat:mongoose-role-example katopz$ create-graphql generate --type Awesome
✗ GraphQL CLI requires Yeoman to be installed.
✗ There was an error while trying to install Yeoman: { Error: Exited with status 127
    at closeArgsToError (/usr/local/lib/node_modules/create-graphql/node_modules/cross-spawn-promise/lib/index.js:20:16)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/create-graphql/node_modules/cross-spawn-promise/lib/index.js:76:19)
    at Object.onceWrapper (events.js:290:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
  exitStatus: 127,
  stdout: null,
  stderr: <Buffer 2f 62 69 6e 2f 73 68 3a 20 79 61 72 6e 3a 20 63 6f 6d 6d 61 6e 64 20 6e 6f 74 20 66 6f 75 6e 64 0a> }
/bin/sh: yo: command not found
(node:10190) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with status 127
(node:10190) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Sorry! 😭

sibelius commented 7 years ago

@katopz I recommend u to use NVM to manage your node versions, it can solve your problem

lucasbento commented 7 years ago

@katopz: it's weird, you uninstalled yarn but it's still on your path.

Can you try hitting which yarn on command-line?

I think we can remove that yarn/npm checking, a lot of users are having problem with yarn :/

felippepuhle commented 7 years ago

I can work on it, if you guys want...

lucasbento commented 7 years ago

I think it's the best we can do right now, yarn itself is not stable yet and a lot of people are using old versions.

To remove the yarn checking, simply change this part, @felippepuhle, and then we can make a release for it.

sibelius commented 7 years ago

can't we try to install yeoman using yarn and check if yeoman was installed successful, if not we install using npm

lucasbento commented 7 years ago

@sibelius: that sounds like an ugly workaround, I wouldn't like that any tool did so.

lucasbento commented 7 years ago

@katopz: we just released 1.1.16 with @felippepuhle's #76 PR, would you mind checking if it works for you?

katopz commented 7 years ago

@lucasbento LGTM no more error with or without yarn

$ create-graphql generate --type Awesome
✗ GraphQL CLI requires Yeoman to be installed.
✓ Yeoman installed!
identical src/type/__tests__/AwesomeType.spec.js
identical src/type/AwesomeType.js
🔥 Type created!

$ which yarn
/usr/local/bin/yarn

$ brew uninstall yarn
Uninstalling /usr/local/Cellar/yarn/0.20.3... (4,740 files, 17.6M)

$ which yarn

$ create-graphql generate --type Awesome
identical src/type/__tests__/AwesomeType.spec.js
identical src/type/AwesomeType.js
🔥 Type created!

BTW, I think I've 2 yarn, one from brew and one from npm Sorry for the mess!

Thanks

lucasbento commented 7 years ago

Yeah, we removed yarn for now, it's not stable yet and not a lot of people have it working.

Don't hesitate on opening a new issue if you need, @katopz.