我已经安装了最新版本的节点并重新启动了系统。我没有代理人。
运行后
npm install -g yo
发生以下错误
C:\>npm install -g yo
npm WARN deprecated cross-spawn-async@2.2.5: 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
> spawn-sync@1.0.15 postinstall C:\Users\US\AppData\Roaming\npm\node_modules\yo\node_modules\spawn-sync
> node postinstall
> yo@2.0.5 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! yo@2.0.5 postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yo@2.0.5 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
当我运行yo --version
它显示
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)
答案 0 :(得分:0)
以“以管理员身份运行”特权运行cmd。就我而言,这是文件访问问题。