【问题标题】:Error "Your yo version is outdated" while setting up our SharePoint Framework development environment设置我们的 SharePoint 框架开发环境时出现错误“您的 yo 版本已过时”
【发布时间】:2018-09-04 23:55:12
【问题描述】:

我正在 Windows 7 x64 中设置我们的 SharePoint 框架开发环境,如本视频所述:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment

我成功安装了Node.js + VS Code,现在我正处于安装yo包的阶段,使用这个命令:

npm install -g yo gulp

但我收到错误"Your yo version is outdated",如下图:

V Global configuration file is valid
V NODE_PATH matches the npm root
V Node.js version
V No .bowerrc file in home directory
V No .yo-rc.json file in home directory
× yo version

Your yo version is outdated.

Upgrade to the latest version by running:
npm install -g yo@latest

V npm version

Found potential issues on your machine :(
+ gulp@3.9.1
+ yo@2.0.5
added 787 packages in 229.024s

所以我运行这个命令来升级yo

npm install -g yo@latest

但我得到了同样的错误:

Running sanity checks on your system

V Global configuration file is valid
V NODE_PATH matches the npm root
V Node.js version
V No .bowerrc file in home directory
V No .yo-rc.json file in home directory
× yo version

Your yo version is outdated.

Upgrade to the latest version by running:
npm install -g yo@latest

V npm version

Found potential issues on your machine :(
+ yo@2.0.5
updated 1 package in 38.439s

我也尝试运行这些命令:

npm rm -g yo
npm install -g yo

但他们没有解决任何问题。

而当我想打开yo,如下,又报错:

PS C:\Users\*****> yo @microsoft/sharepoint
yo : The term 'yo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ yo @microsoft/sharepoint
+ ~~
    + CategoryInfo          : ObjectNotFound: (yo:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

谁能给点建议?

【问题讨论】:

    标签: node.js powershell sharepoint yo spfx


    【解决方案1】:

    修复了 Windows 10/x64 上的相同问题,尽管我安装的 nodejs 是非标准的“C:\nodejs\”。 我将 NODE_PATH 修复为

    c:\nodejs;c:\nodejs\node_modules\npm\node_modules"
    

    和要包含的路径

    c:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;
    c:\nodejs\node_modules\npm\node_modules\windows-build-tools\node_modules\.bin;
    c:\nodejs\node_modules\npm\;
    c:\nodejs;
    

    也许问题是你的医生无法找到自己

    【讨论】:

      【解决方案2】:

      我在 3 台不同的 PC 上遇到了同样的错误,但现在它们都可以正常工作了。据我所知,NodeJS 8.x 版无法正确安装 Yo,但 SPFx 需要 8 才能运行。这些步骤在所有 3 台 PC(运行 Windows 10)上都适用于我:

      1. 安装 NodeJS 版本 10.x(当前为 LTS 版本)

      2. 从 microsoft 教程中运行这些命令:

        -- npm install -g yo gulp

        -- npm install -g @microsoft/generator-sharepoint

      3. 此时,您可以创建一个 Web 部件:yo @microsoft/sharepoint

      4. 如果你尝试运行gulp serve,它会报错,说你必须使用低于9的NodeJS版本: 一种。卸载 NodeJS 10.x 湾。安装 NodeJS 8.15 版

      5. 如果你现在运行 gulp serve,它会再次出错,但会告诉你你的环境已经改变,并给你一个运行命令。运行命令:npm rebuild node-sass

      6. (可选)避免出现证书错误消息,运行以下命令:gulp trust-dev-cert

      您现在应该能够使用正确版本的 Node 和 Yo 在 SPFx Web 部件上运行 gulp serve。

      我真的很想抛出一个“......鲍勃是你的叔叔!”参考这里的100。

      【讨论】:

        猜你喜欢
        • 2018-12-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多