1

I want to build my first SPFX React web part, so i am following this article:-

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/use-fabric-react-components

first step i want to install the @microsoft/generator-sharepoint, so i open my sharepoint online management shell, and i run this command , as follow:-

PS C:\> npm i @microsoft/generator-sharepoint > [email protected] postinstall C:\node_modules\spawn-sync > node postinstall 

i got these warning :- enter image description here

then i want to create a new web part by running the Yeoman SharePoint generator, so i run this command:-

yo @microsoft/sharepoint 

but i got this error:-

PS C:\documentcardexample-webpart> 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) [], CommandNotFoundE xception + FullyQualifiedErrorId : CommandNotFoundException 

so can anyone advice why i am unable to create my web part?

EDIT

I run this command:-

PS C:\windows\system32> npm install -g yo gulp 

but i got this result that the yo version is outdated:-

npm WARN invalid config proxy="http://:/" npm WARN invalid config Must be a full url with 'http://' npm WARN invalid config proxy="http://:/" npm WARN invalid config Must be a full url with 'http://' npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, follo wing the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for comp atibility with current and future versions of Node.js npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compa tibility with current and future versions of Node.js C:\Users\****\AppData\Roaming\npm\gulp -> C:\Users\****\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js C:\Users\****\AppData\Roaming\npm\yo -> C:\Users\****\AppData\Roaming\npm\node_modules\yo\lib\cli.js C:\Users\****\AppData\Roaming\npm\yo-complete -> C:\Users\****\AppData\Roaming\npm\node_modules\yo\lib\completion\in dex.js > [email protected] postinstall C:\Users\****\AppData\Roaming\npm\n ode_modules\yo > yodoctor Yeoman Doctor 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 V npm version × yo version Your yo version is outdated. Upgrade to the latest version by running: npm install -g yo@latest Found potential issues on your machine :( + [email protected] + [email protected] updated 2 packages in 50.326s 

so i run this command, as per the above error message:-

PS C:\windows\system32> npm install -g yo@latest 

but i got this error:-

npm WARN invalid config proxy="http://:/" npm WARN invalid config Must be a full url with 'http://' npm WARN invalid config proxy="http://:/" npm WARN invalid config Must be a full url with 'http://' C:\Users\****\AppData\Roaming\npm\yo -> C:\Users\***\AppData\Roaming npm\node_modules\yo\lib\cli.js C:\Users\****\AppData\Roaming\npm\yo-complete -> C:\Users\ ****\AppData\Roaming\npm\node_modules\yo\lib\completion\in dex.js > [email protected] postinstall C:\Users\****\AppData\Roaming\npm\n ode_modules\yo > yodoctor Yeoman Doctor 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 V npm version × yo version Your yo version is outdated. Upgrade to the latest version by running: npm install -g yo@latest Found potential issues on your machine :( + [email protected] updated 1 package in 9.169s 
10
  • 1
    you need to be using visual studios code, not running this in the management shell... This is a prerequisite to all of the dev articles...docs.microsoft.com/en-us/sharepoint/dev/spfx/… Commented Sep 3, 2018 at 23:06
  • @Mike can i use Visual studio 2015 professional or i have to use visual studio code? Commented Sep 4, 2018 at 0:54
  • Why would you? Visual studios code is made for this kind of development. Its free Commented Sep 4, 2018 at 1:01
  • @Mike ok i download VS code, and i start installing the pre-requisits as mention in the link you provide, now i face this issue when i install yo Your yo version is outdated. i tied running the suggested upgrade command inside the error npm install -g yo@latest .. but still i got the same error that Your yo version is outdated.... now sure what is the problem? Commented Sep 4, 2018 at 1:21
  • 1
    You should be doing that within the vs terminal Commented Sep 4, 2018 at 2:04

2 Answers 2

2
+50

It seems like you don't have correct config proxy url. Please try to set the proxy url by using the following command. It may help you to resolve the issue.

npm config set https-proxy "full proxy url" npm config set proxy "same url" npm config set strict-ssl false 

To check the current config list use the below command.

npm config list 
0
2

You need to run npm install -g yo gulp to install yo and gulp from global first so that you can have yo and gulp command ready. Please reference Set up your SharePoint Framework development environment for detail

1
  • ok thanks for the reply, actually since i wrote this question, i have tried another commands but they are not working.. can you please check my edit to the original question with the updated results.. thanks Commented Sep 5, 2018 at 21:13

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.