我正在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
有人可以建议吗?
答案 0 :(得分:0)
修复了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;
也许问题是溜溜医生无法找到自己
答案 1 :(得分:0)
我在3台不同的PC上遇到了相同的错误,但是现在它们都可以正常工作了。据我所知,NodeJS的8.x版本无法正确安装Yo,但是SPFx需要运行8。这些步骤对我所有3台PC(运行Windows 10)均有效:
安装NodeJS 10.x版本(当前为LTS版本)
从Microsoft教程中运行以下命令:
-npm install -g yo gulp
-npm install -g @microsoft/generator-sharepoint
这时,您可以创建一个Web部件:yo @microsoft/sharepoint
如果尝试运行gulp serve
,它将出错,并指出您必须使用低于9的NodeJS版本:
一种。卸载NodeJS 10.x
b。安装NodeJS版本8.15
如果现在运行gulp serve,它将再次出错,但会告诉您您的环境已更改,并给您运行命令。运行命令:npm rebuild node-sass
(可选)避免出现证书错误消息,请运行以下命令:gulp trust-dev-cert
您现在应该可以使用正确版本的Node和Yo在SPFx Web部件上运行gulp服务。
我真的想抛出一个“……鲍勃是你的叔叔!”在这里参考100。