10

I never used Yeoman, did everything by the Microsoft SPFx book (and now feel stupid):

https://github.com/SharePoint/sp-dev-docs/wiki/Setup-your-machine

Using the suggested Cmder for windows

Note: my other Node stuff in Webstorm 2016.2 runs just fine

Command:

npm i -g yo gulp

Works fine:

npm i -g @microsoft/generator-sharepoint

Seems to be fine:

When I start the HelloWord example

The command

yo @microsoft/sharepoint

Clearly doesn't work:


I know it is a simple question, just getting ahead before the jQuery copy/pasters get into the game (and I am too lazy to fix it myself)

tnx

3
  • Does it work if you use the normal cmd prompt. And tbh - there's no need at all to use cmder, personally I haven't used it at all. Normal cmd console or PowerShell console works fine. Aug 19, 2016 at 8:30
  • I am playing jQuery developer, do exactly what Microsoft/MVP blogs tell me to do. Root cause is the NPM folder is not in the %PATH% ... But many jQuery youngsters will never have seen an 80s command prompt Aug 19, 2016 at 9:53
  • 1
    In 2007 it took me 5 minutes to add jQuery to a SharePoint page and do front-end stuff... it now took me 3 hours (getting all tooling in place)... But YEAH! I got an Hello World webpart! Aug 19, 2016 at 10:40

6 Answers 6

10
  1. install the latest version of node
  2. install the latest version of npm: npm i -g npm@next
  3. run the following in your cmd window or commander window:

    call npm uninstall -g chalk
    call npm uninstall -g loadash
    call npm uninstall -g tar-fs
    call npm uninstall -g update-notifier
    call npm uninstall -g yeoman-generator
    call npm uninstall -g yosay
    call npm uninstall -g yo
    call npm uninstall -g gulp
    call npm uninstall -g @microsoft/generator-sharepoint
    
    call npm install -g chalk
    call npm install -g loadash
    call npm install -g tar-fs
    call npm install -g update-notifier
    call npm install -g yeoman-generator
    call npm install -g yosay
    
    call npm install -g yo
    call npm install -g gulp
    
    call npm install -g @microsoft/generator-sharepoint
    

these commands set will install some missing modules that were not installed when you followed the doc on github(and no you weren't stupid)

once you run the above, you can run the yo command to create your helloworld

$ yo @microsoft/generator-sharepoint

and you will have your hello world app.... (what a way to go for a Hello World)

PS: you don't need commander, the CMD will do just fine, just make sure the node path is included in the %PATH% variable and can be found by gulp.

:)

7

Most likely cause is the NPM folder is missing from the PATH declaration, so it can not find the commands installed in the NPM folder

For Windows:

Check if everything is correctly installed

Execute in a command prompt:

dir %appdata%\npm\*.cmd /b

This should list the available commands:

Execute the Yeoman SharePoint Generator

%appdata%\npm\yo @microsoft/sharepoint

add NPM folder to %PATH%

If you add the npm folder to the PATH you do not have to reference the full path all the time

  • Go to My Computer + Right Click "Properties"
  • Advanced System Settings (On the left)
  • Click on Environment Variables
  • Click on Edit
  • Path Add "%appdata%\npm\;" to the end

    * Click ok and reopen Cmd(r)

Only addition of environment variable "path" will do in case of a new user logged in to the machine but using the VS installed by other user. Tested and verified in OS - Windows 10. VS -2015.

2

Sometimes you need to refresh the PATH. I just open a new command window, which seems to be the simplest way of doing this.

0

This is a more updated answer: - npm install -g yo gulp - npm install -g @microsoft/generator-sharepoint

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

0

in my case this is worked:

yo.cmd code

Test this one:

Replace Saber with your folder name:

C:\Users\Saber\AppData\Roaming\npm\yo.cmd code
0

Use the command

npx yo

that should do what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.