代码之家  ›  专栏  ›  技术社区  ›  john Gu

设置SharePoint框架开发环境时出现错误“您的yo版本已过时”

  •  1
  • john Gu  · 技术社区  · 8 年前

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

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

    我已成功安装Node.js节点+VS代码,现在我正处于安装 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
    

    所以我运行这个命令升级 哟 :

    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
    

    但他们什么也没修好。

    当我想打开的时候 哟 ,如下所示,我得到另一个错误:

    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
    

    有人能给我建议吗?

    2 回复  |  直到 8 年前
        1
  •  0
  •   JWow    7 年前

    修复了Windows 10/x64上的相同问题,尽管我安装的nodejs不是标准的“C:\ nodejs\”。 我把节点路径修好了

    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
  •  0
  •   Şivā SankĂr    7 年前

    我在3台不同的电脑上也出现了同样的错误,但现在它们都正常工作了。据我所知,NodeJS的8.x版本无法正确安装Yo,但SPFx需要8才能运行。这些步骤对我在所有3台电脑(运行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版本: a、 卸载NodeJS 10.x b、 安装NodeJS版本8.15

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

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

    现在您应该可以使用Node和Yo的正确版本在SPFx web部件上运行gulp-serve。

    我真的很想扔一个。。。鲍伯是你叔叔!”这里是100的参考。