Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install yo on windows

I have installed the latest version of node and rebooted the system. I am not behind a proxy.

After running

npm install -g yo

Following error occurs

C:\>npm install -g yo
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\US\AppData\Roaming\npm\yo-complete -> C:\Users\US\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js
C:\Users\US\AppData\Roaming\npm\yo -> C:\Users\US\AppData\Roaming\npm\node_modules\yo\lib\cli.js

> [email protected] postinstall C:\Users\US\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall C:\Users\US\AppData\Roaming\npm\node_modules\yo
> yodoctor


**Yeoman Doctor
Running sanity checks on your system**

C:\Users\US\AppData\Roaming\npm\node_modules\yo\node_modules\global-tunnel-ng\index.js:231
    throw e;
    ^

**Error: upstream proxy port is required**
    at Object.globalTunnel.initialize (C:\Users\US\AppData\Roaming\npm\node_modules\yo\node_modules\global-tunnel-ng\index.js:192:13)
    at Object.<anonymous> (C:\Users\US\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-doctor\lib\cli.js:6:29)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
**npm ERR! [email protected] postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.**
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\US\AppData\Roaming\npm-cache\_logs\2018-12-14T14_55_52_156Z-debug.log

and when I run yo --version

It shows

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'C:\Users\US\AppData\Roaming\npm\node_modules\yo\lib\cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
like image 218
Nida Munir Avatar asked Apr 28 '26 08:04

Nida Munir


1 Answers

Run the cmd with "Run as administrator" privilege. In my case it was a file access issue.

like image 128
Ben M Avatar answered Apr 30 '26 02:04

Ben M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!