Typescript errors in SharePoint Framework webparts
-
14-12-2020 - |
Pergunta
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.
Can anyone help me on how to fix the issue. as per the descriptions, the error are in the Typescript.
Solução
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.
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
Outras dicas
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.