Error with SharePoint Framework’s Newest Release (RC0) using Build a Hello Web Part
[UPDATE] The latest release (General availability) fixed this issue with the generator, find more info in the release notes here: https://github.com/SharePoint/sp-dev-docs/wiki/Release-Notes-GA
I recently installed NodeJS with all the trimmings in order to test the newest framework release now that the SharePoint Framework has been “released”. However, while running a fresh deployment of the SPFx toolset on my development machine, I ran into an error with the Hello World Process that left me unable to actually deploy my web part. You can see below the issue in the log generated when running the gulp serve command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
E:\src\helloworld-webpart>gulp serve Build target: DEBUG [22:58:11] Using gulpfile E:\src\helloworld-webpart\gulpfile.js [22:58:11] Starting gulp [22:58:11] Starting 'serve'... [22:58:11] Starting subtask 'pre-copy'... [22:58:11] Finished subtask 'pre-copy' after 8.26 ms [22:58:11] Starting subtask 'copyStaticAssets'... [22:58:11] Starting subtask 'sass'... [22:58:12] Finished subtask 'sass' after 584 ms [22:58:12] Starting subtask 'tslint'... [22:58:12] Starting subtask 'typescript'... [22:58:12] [typescript] Using custom version: 2.0.10 [22:58:12] Finished subtask 'copyStaticAssets' after 644 ms [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,21): error TS1005: ']' expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,22): error TS1005: ';' expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,23): error TS1128: Declaration or statement expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,33): error TS1005: ']' expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,34): error TS1005: ')' expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,35): error TS1128: Declaration or statement expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(11444,37): error TS1128: Declaration or statement expected. [22:58:15] Error - typescript - node_modules\@types\lodash\index.d.ts(19441,1): error TS1128: Declaration or statement expected. [22:58:15] Finished subtask 'tslint' after 2.84 s [22:58:15] Error - 'typescript' sub task errored after 2.85 s "TypeScript error(s) occurred." [22:58:15] 'serve' errored after 3.48 s [22:58:15] [22:58:15] ==================[ Finished ]================== Error - typescript - node_modules\@types\lodash\index.d.ts(11444,21): error TS1005: ']' expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,22): error TS1005: ';' expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,23): error TS1128: Declaration or statement expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,33): error TS1005: ']' expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,34): error TS1005: ')' expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,35): error TS1128: Declaration or statement expected. Error - typescript - node_modules\@types\lodash\index.d.ts(11444,37): error TS1128: Declaration or statement expected. Error - typescript - node_modules\@types\lodash\index.d.ts(19441,1): error TS1128: Declaration or statement expected. Error - 'typescript' sub task errored after 2.85 s "TypeScript error(s) occurred." [22:58:16] Project helloworld-webpart version: 0.0.1 [22:58:16] Build tools version: 1.1.0 [22:58:16] Node version: v6.9.5 [22:58:16] Total duration: 6.29 s [22:58:16] Task errors: 9 |
To be clear, I ran the instructions directly from the Build a Hello Web Part page. So I was a little confused the default process would leave me stranded. A little bit of investigation later, I ended up in this thread https://github.com/SharePoint/sp-dev-docs/issues/394. Down near the bottom of the thread it is pointed out that in the recent upgrade to typescript left things in the lurch. So it requires an additional command to run correctly. So I ran:
1 |
npm install @types/lodash@4.14.50 |
And this resolves the issue enabling NodeJS to serve the content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
E:\src\helloworld-webpart>gulp serve Build target: DEBUG [23:00:33] Using gulpfile E:\src\helloworld-webpart\gulpfile.js [23:00:33] Starting gulp [23:00:33] Starting 'serve'... [23:00:33] Starting subtask 'pre-copy'... [23:00:33] Finished subtask 'pre-copy' after 8.77 ms [23:00:33] Starting subtask 'copyStaticAssets'... [23:00:33] Starting subtask 'sass'... [23:00:34] Finished subtask 'sass' after 572 ms [23:00:34] Starting subtask 'tslint'... [23:00:34] Starting subtask 'typescript'... [23:00:34] [typescript] Using custom version: 2.0.10 [23:00:34] Finished subtask 'copyStaticAssets' after 647 ms [23:00:37] Finished subtask 'tslint' after 2.78 s [23:00:37] Finished subtask 'typescript' after 2.78 s [23:00:37] Starting subtask 'ts-npm-lint'... [23:00:37] Finished subtask 'ts-npm-lint' after 33 ms [23:00:37] Starting subtask 'post-copy'... [23:00:37] Finished subtask 'post-copy' after 653 μs [23:00:37] Starting subtask 'collectLocalizedResources'... [23:00:37] Finished subtask 'collectLocalizedResources' after 8.8 ms [23:00:37] Starting subtask 'configure-webpack'... [23:00:40] Finished subtask 'configure-webpack' after 3.01 s [23:00:40] Starting subtask 'webpack'... [23:00:41] Finished subtask 'webpack' after 698 ms [23:00:41] Starting subtask 'configure-webpack-external-bundling'... [23:00:41] Finished subtask 'configure-webpack-external-bundling' after 1.43 ms [23:00:41] Starting subtask 'copyAssets'... [23:00:41] Finished subtask 'copyAssets' after 26 ms [23:00:41] Starting subtask 'writemanifests'... [23:00:44] Finished subtask 'writemanifests' after 3.35 s [23:00:44] Starting subtask 'serve'... [23:00:44] Warning - [serve] When serving in HTTPS mode, a PFX cert path or a cert path and a key path must be provided, or a dev certificate must be generated and trusted. If a SSL certificate isn't provided, a default, self-signed certificate will be used. Expect browser security warnings. Starting api server on port 5432. Registring api: /getwebparts Registring api: /*.* Registring api: /workbench [23:00:45] Finished subtask 'serve' after 553 ms [23:00:45] Finished 'serve' after 11 s [23:00:45] Server started https://localhost:4321 [23:00:45] LiveReload started on port 35729 [23:00:45] Opening https://localhost:5432/workbench using the default OS app [23:00:45] ==================[ Finished ]================== Warning - [serve] When serving in HTTPS mode, a PFX cert path or a cert path and a key path must be provided, or a dev certificate must be generated and trusted. If a SSL certificate isn't provided, a default, self-signed certificate will be used. Expect browser security warnings. [23:00:46] Project helloworld-webpart version: 0.0.1 [23:00:46] Build tools version: 1.1.0 [23:00:46] Node version: v6.9.5 [23:00:46] Total duration: 14 s [23:00:46] Task warnings: 1 |
Hope this helps someone else from beating their head on the desk trying to figure out the issue.
3 thoughts on “Error with SharePoint Framework’s Newest Release (RC0) using Build a Hello Web Part”
Hey Isaac,
Glad to see you’ve gotten a chance to try out SPFx.
Did you notice that anyone can edit the docs now? Click “Edit in Github” and you can submit a pull request directly in the browser with markdown.
Tom
Hi Tom! I love the move over to the Git Hub Documents, will the edits propagate to the Office Dev center?
Yes. The edits will show up in their published location fed from GitHub. Your edit will be submitted as a pull request, which the team will manage.