yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Yo fails to run after install #785

Open zubair1103 opened 1 year ago

zubair1103 commented 1 year ago

Type of issue


My environment

Expected behavior

yo command should work as normal

Current behavior

After installing the yo globally I tried to run yo command but it is throwing the error. See shell output below. Error is different for different versions of yo with same steps.

Steps to reproduce the behavior

Install Ubuntu on WSL 2 Install NVM Install Node Install Yo

Command line output

root@SLT92Zubair:/# yo
/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/conf/index.js:128
                        throw err;
                        ^

Error: EACCES: permission denied, open '/root/.config/insight-nodejs/insight-yo.json'
    at Object.openSync (node:fs:601:3)
    at Object.readFileSync (node:fs:469:35)
    at get store [as store] (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/conf/index.js:108:18)
    at Conf.get (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/conf/index.js:47:27)
    at get optOut [as optOut] (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/insight/lib/index.js:52:22)
    at Object.<anonymous> (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js:208:48)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/root/.config/insight-nodejs/insight-yo.json'
}

Node.js v18.16.0
root@SLT92Zubair:/#

NOTE:

PLEASE NOTE THAT Yo 4.3.1 THROWS A DIFFERENT ERROR WHILE PERFORMING SAME STEPS

root@SLT92Zubair:/# yo --version
4.3.1
root@SLT92Zubair:/# node -v
v18.16.0
root@SLT92Zubair:/# npm -v
9.5.1
root@SLT92Zubair:/# yo
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module 'is-ci'
Require stack:
- /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js
- /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at lazy (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/import-lazy/index.js:2:51)
    at /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/import-lazy/index.js:10:11
    at new UpdateNotifier (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js:46:4)
    at module.exports (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js:183:25)
    at updateCheck (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js:54:20)
    at Object.<anonymous> (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js:187:1) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js',
    '/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js'
  ]
}

Node.js v18.16.0
root@SLT92Zubair:/#
shayeLee commented 1 year ago

I encountered the same problem.

Mitschiro commented 1 year ago

Same Error Windows 11 -> WSL 2 -> Ubuntu 22.04.2

`Error: Cannot find module 'is-ci' Require stack:

ytnytn1 commented 1 year ago

Same Error Windows 11 -> WSL 2 -> Ubuntu 22.04.2

`Error: Cannot find module 'is-ci' Require stack:

  • /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js
  • /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Module.require (node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at lazy (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/import-lazy/index.js:2:51) at /root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/import-lazy/index.js:10:11 at new UpdateNotifier (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js:46:4) at module.exports (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js:183:25) at updateCheck (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js:54:20) at Object. (/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js:187:1) { code: 'MODULE_NOT_FOUND', requireStack: [ '/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/node_modules/update-notifier/index.js', '/root/.nvm/versions/node/v18.16.0/lib/node_modules/yo/lib/cli.js' ] }`

I have the same error in win 10, wsl2

g-taiji-tanaka commented 1 year ago

Same Error. Win10 WSL2 Ubuntu 22.04.2 Node 18.16.0 npm 9.5.1

BaschtianXD commented 1 year ago

I encountered the same error. Win 11, WSL2, Ubuntu 22.04.2, Node 18.16.0, npm 9.5.1

verikono commented 1 year ago

bumpty bump bump. Win 11, WSL2, Ubuntu 22.04.2, Node 20.5.0, npm 9.8.1

edit: found the issue to be the root user login - ie. I was logging into the WSL2/Ubuntu container as root. Added myself as as user and set that to the default login and yo performs as expected.

danboggins commented 9 months ago

Running into the same problem on Ubuntu (no WSL):

root@host:/opt/ppp/TEST# yo
node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module 'is-ci'
Require stack:
- /root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/update-notifier/index.js
- /root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/lib/cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at lazy (/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/import-lazy/index.js:2:51)
    at /root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/import-lazy/index.js:10:11
    at new UpdateNotifier (/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/update-notifier/index.js:46:4)
    at module.exports (/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/update-notifier/index.js:183:25)
    at updateCheck (/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/lib/cli.js:54:20)
    at Object.<anonymous> (/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/lib/cli.js:190:1) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/node_modules/update-notifier/index.js',
    '/root/.nvm/versions/node/v20.11.0/lib/node_modules/yo/lib/cli.js'
  ]
}

If I attempt to run yo as a user:

testuser@host:/opt/ppp/TEST$ yo
Error: Not supported
    at init (/usr/local/lib/node_modules/yo/lib/cli.js:122:23)
    at pre (/usr/local/lib/node_modules/yo/lib/cli.js:83:9)
    at /usr/local/lib/node_modules/yo/lib/cli.js:193:9
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:194:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

node: 20.11.0 npm: 10.2.4 Ubuntu: 20.04 LTS

mvsenin commented 8 months ago

How, how, how... same issue (almost) image

Is there any thought on that?

Thanks.

SBoudrias commented 8 months ago

@mvsenin you should upgrade node to an LTS version. Unsupported versions can be dangerous for your business and your users.

Now this is affecting yo, but once fixed on our dependencies, it risks appearing on another library. You'll be playing whack a mole with dependencies until you upgrade to an LTS Node version (18 as of now). https://nodejs.org/en/about/previous-releases

mvsenin commented 7 months ago

@SBoudrias Hi Simon, thanks, I've done that, node version is 20.12.0, but now I'm getting the Error: Cannot find module 'is-ci'...

Physicalpixel commented 6 months ago

Did we find a solution to this?

zubair1103 commented 6 months ago

After wasting few days on this, I finally installed it using WSL 2 + Ubuntu + root user then installed Superset in Ubuntu instead of Windows. This way it worked for me.

gbamqzkdyg commented 5 months ago

I am facing the error today on Windows 11.

yo code
Error: Not supported
    at init (C:\Users\lucama\AppData\Roaming\npm\node_modules\yo\lib\cli.js:122:23)
    at pre (C:\Users\lucama\AppData\Roaming\npm\node_modules\yo\lib\cli.js:83:9)
    at C:\Users\lucama\AppData\Roaming\npm\node_modules\yo\lib\cli.js:193:9
    at Object.<anonymous> (C:\Users\lucama\AppData\Roaming\npm\node_modules\yo\lib\cli.js:194:3)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11

image

epaezrubio commented 5 months ago

This issue deserves more attention IMO. At the moment the yo command is unusable on WSL :(

YinYang117 commented 4 months ago

Fresh global instal of yo on wsl 2 with windows 11. run command: yo code

`node:internal/modules/cjs/loader:1147 throw err; ^

Error: Cannot find module 'is-ci' Require stack:

d-duer commented 3 months ago

Echoing verikono's comment that installing and using yo from a user other than root fixes this.

epaezrubio commented 2 months ago

I agree that that is a workaround, but I wouldn't consider it a fix. Specially since no other npm packages (that I know) have this issue.

hilleer commented 3 weeks ago

bumpty bump bump. Win 11, WSL2, Ubuntu 22.04.2, Node 20.5.0, npm 9.8.1

edit: found the issue to be the root user login - ie. I was logging into the WSL2/Ubuntu container as root. Added myself as as user and set that to the default login and yo performs as expected.

There is a lot of unknowns in this workaround :-) Would you mind describing (or linking) how to achieve this?