Question

I created a new sharePoint framework webpart using the msdn link

https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/build-a-hello-world-web-part

After Executing the gulp serve commands i got the below errors. please check the below image. enter image description here

Can anyone help me on how to fix the issue. as per the descriptions, the error are in the Typescript.

Was it helpful?

Solution

In the screenshot, i see that you are running the Node v6.9.4 . You should uninstall this Node version and instead install the Node v4.6.0 LTS version. Today SharePoint Framework requires Node.js 4.6.0 to run, in future it may run on the latest and greatest version of Node, but right now you should install v4.6.0 to get it running.

Download link - Node v4.6.0

I have it installed and its running smoothly.

enter image description here

Update

As Sergei mentioned, its incompatible with typescript 2.0.xx.

You can also try below command and then run gulp serve again:

npm install @types/lodash@4.14.50

SPFx Web Part will not compile - lodash errors occur

OTHER TIPS

Recent changes in lodash module made it incompatible with typescript 2.0.x.

You can either upgrade typescript to 2.1.5 by running npm install typescript --save-dev or install previous definitions for lodash by removing node_modules/@types/lodash, and running npm install @types/lodash@ts2.0.

More info here

PS. welcome to "awesome" web-frontend world.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top