I want to build my first SPFX React web part, so i am following this article:-
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
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
Your yo version is outdated.
i tied running the suggested upgrade command inside the errornpm install -g yo@latest
.. but still i got the same error thatYour yo version is outdated.
... now sure what is the problem?