1
votes

I am setting up our SharePoint framework development environment inside Windows 7 x64, as mentioned in this video:

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

I successfully installed Node.js + VS Code, and now I am at the stage of installing the yo package, using this command:

npm install -g yo gulp

but I got error "Your yo version is outdated", as shown below:

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 :(
+ [email protected]
+ [email protected]
added 787 packages in 229.024s

So I ran this command to upgrade yo:

npm install -g yo@latest

but I got the same error:

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 :(
+ [email protected]
updated 1 package in 38.439s

I also tried running these commands:

npm rm -g yo
npm install -g yo

but they did not fix anything.

And when I wanted to open yo, as follows, I got another error:

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

Can anyone please advise?

2

2 Answers

0
votes

Fixed same problem on Windows 10/x64, though my installation of nodejs was non-standard "C:\nodejs\". I fixed up the NODE_PATH to

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

and PATH to include

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;

Perhaps the problem was that the yo doctor could not have been able to find itself

0
votes

I was getting the same error on 3 different PCs, but I now have them all working. As near as I can tell, version 8.x of NodeJS cannot correctly install Yo, but SPFx requires 8 to run. These steps worked for me on all 3 PCs (running Windows 10):

  1. install NodeJS version 10.x (currently the LTS version)

  2. run these commands from the microsoft tutorial:

    -- npm install -g yo gulp

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

  3. At this point, you can create a web part: yo @microsoft/sharepoint

  4. If you try to run gulp serve, it will error, saying you must use a NodeJS version below 9: a. Uninstall NodeJS 10.x b. Install NodeJS version 8.15

  5. If you now run gulp serve, it will again error, but tell you that your environment has changed and give you a command to run. Run the command: npm rebuild node-sass

  6. (Optional) avoid the certificate error message, run the follow: gulp trust-dev-cert

You should now be able to run gulp serve on your SPFx web parts using the correct versions of Node and Yo.

I really want to throw a "... and Bob's your uncle!" reference for the 100 in here.