2

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.

5
  • Can you run npm i -g @microsoft/generator-sharepoint@latest and recreate the project ? Looks like old version of SPFx Commented Feb 7, 2017 at 6:33
  • @Gautam Sheth Thanks for the quick response. Will try and update you..
    – TARUN
    Commented Feb 7, 2017 at 6:35
  • @Gautam Sheth : This time iam getting another error as below. C:\spfxwebparts\secondapp>gulp servce Build target: DEBUG [12:30:43] Using gulpfile C:\spfxwebparts\secondapp\gulpfile.js [12:30:43] Task 'servce' is not in your gulpfile [12:30:43] Please check the documentation for proper gulpfile formatting [12:30:43] Task 'servce' is not in your gulpfile [12:30:43] Please check the documentation for proper gulpfile formatting About to exit with code: 1 Process terminated before summary could be written, possible error in async code not continuing! Trying to exit with exit code 1
    – TARUN
    Commented Feb 7, 2017 at 6:54
  • You made a spelling mistake , make it gulp serve :) Commented Feb 7, 2017 at 6:55
  • @Gautam Sheth :Sorry now executed the correct gulp serve command and got the same error as above image.
    – TARUN
    Commented Feb 7, 2017 at 6:59

2 Answers 2

3

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/[email protected]

SPFx Web Part will not compile - lodash errors occur

2
  • I am getting the same error with the node version 4.6.0. I updated the image in the question with the node version 4.6.0
    – TARUN
    Commented Feb 7, 2017 at 7:38
  • Thanks for your answer npm install @types/[email protected] was worked for me. Now able to see the output in workbench
    – TARUN
    Commented Feb 7, 2017 at 9:44
5

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/[email protected].

More info here

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

2
  • Thanks for your answer npm install @types/[email protected] was worked for me. once again Thank you..
    – TARUN
    Commented Feb 7, 2017 at 9:43
  • installing typescript 2.1.5 fix d thsis for me.
    – RussGove
    Commented Feb 14, 2017 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.