[英]Error “Your yo version is outdated” while setting up our SharePoint Framework development environment
如視頻中所述,我正在Windows 7 x64中設置我們的SharePoint框架開發環境:
https://docs.microsoft.com/zh-cn/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
任何人都可以請教嗎?
修復了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;
也許問題是溜溜醫生無法找到自己
我在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。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.