SPFx – Troubleshooting Yeoman Generator

SharePoint Framework (SPFx) is a page and web part model that provides full support for client-side SharePoint development. You can use modern web technologies and tools to build productive experiences and apps that are responsive and mobile ready. To start the development environment, you have to install following tools:

  1. NodeJS
  2. Yeoman
  3. Gulp

You will also need to install code editor such as Visual Studio Code, Sublime Text, Atom, Webstorm etc. For me, I prefer Visual Studio Code since it integrates well with git in Visual Studio Online. You can read the instruction to install NodeJS, Yeoman and Gulp from Microsoft article here – https://dev.office.com/sharepoint/docs/spfx/set-up-your-development-environment.

In addition, I suggest that you also install CMDER (http://cmder.net/) , to replace original command prompt. This console has missing and important feature from original command prompt, which is Copy + Paste (CTRL C + V).

Unfortunately, the set-up doesn’t go well in my machine Windows 10. When I started to create my first SPFx project using command:

it returns following error “write EINVAL”

The same error, will be returned by running yo without any parameter.

Searching in NodeJS issue list (https://github.com/nodejs/node/issues/9542), it is indeed bug in version < 7.2.0. So the solution is quite simple, upgrade NodeJS to version 7.2.0 or newer. Since I am using NVM (node version manager) for windows (https://github.com/coreybutler/nvm-windows), I just type following command

Once Node version 7.2.0 has been installed, I can start to call Yeoman and scaffold SharePoint project successfully.

Leave a Reply