【问题标题】:Cannot install yo on windows不能在windows上安装哟
【发布时间】:2018-12-14 15:21:14
【问题描述】:

我已经安装了最新版本的节点并重新启动了系统。我不在代理后面。

运行后

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)

【问题讨论】:

  • 您是否在使用代理?也请格式化以便更容易阅读问题
  • 不,我不在代理服务器后面。
  • 我也遇到同样的错误,你能解决吗?我在代理服务器后面,但代理似乎不是问题,因为 我能够安装其他软件包
  • 我没有安装和使用你就离开了。我找到了另一种创建项目的解决方案。

标签: node.js npm yeoman


【解决方案1】:

以“以管理员身份运行”权限运行 cmd。就我而言,这是一个文件访问问题。

【讨论】:

    猜你喜欢
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 2018-08-21
    • 1970-01-01
    相关资源
    最近更新 更多