Question

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

Was it helpful?

Solution

  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.

:)

OTHER TIPS

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.

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

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

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
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top