Fix SharePoint Framework Hello World WebPart

Hello everyone,

Today I will talk about an error that may occur when you try to follow the SharePoint Framework tutorial to create the HelloWorld webpart: https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/build-a-hello-world-web-part

Problematic

When you follow the tutorial, using the “gulp serve” command generates the following errors

Error - typescript - node_modules\@types\lodash\index.d.ts(8446,32): error TS1005: ',' expected.
Error - typescript - node_modules\@types\es6-collections\index.d.ts(78,29): error TS2304: Cannot find name 'object'.

 

Cause

The SharePoint Framework evolved very quickly in a very short time. You may have a template version that is not up to date.

Resolution

To resolve these errors, simply get the last version of the template with the following command

npm install -g @microsoft/generator-sharepoint@latest

If it is not enough,  install the correct versions of lodash and es6-collection via the following commands

npm install @types/lodash@4.14.50
npm install @types/es6-collections@0.5.29

Hoping this helps

Christopher.

Advertisements