Yeoman generator, which you installed after Node.js and npm, tends to get frequent updates from Microsoft. When developing for SharePoint Online using the SharePoint Framework, you should always choose the latest stable Yeoman templates by running the following command:
npm install -g @microsoft/generator-sharepoint
This pulls in the latest version from https://www.npmjs.com/package/@microsoft/generator-sharepoint and installs the necessary templates.
To verify the current version of Yeoman templates, use the following command:
npm list -g | find "sharepoint"
This should print out the version number. At the time of writing this book, the latest version was 1.2.0:
If, however, you are aiming to create the SharePoint Framework solutions for SharePoint 2016 that together with SharePoint Feature Pack 2 (FP2) provides limited support for SPFx, you may need to switch to a different version corresponding to the version of the Yeoman templates...