Hot answers tagged

7

In the previous versions 'web' was still present in the rest.d.ts file of the @pnp/sp package. That's not the case anymore. In your main webpart TypeScript file, you have to use the import as follow: import { sp } from "@pnp/sp/presets/all";


5

In 1.6.0 projects the config/tslint.json file was removed and a new one is created at the root of the solution. Delete E:\DevEnv\WebParts\react-full-iframe\config\tslint.json. You should also add the new tslint.json at the root of your project. To help upgrade your project and make sure you didn't forget anything, you could use the office 365 cli. the next ...


3

Try to reinstall node js version 8.* https://nodejs.org/dist/latest-v8.x/ It is officaly supported version by Microsoft. Then try to run yo generator without the parameters. Only yo @microsoft/sharepoint. Perhaps try to update Microsoft generator.


3

Instead of creating a different projects for the webparts, please create all the webparts in a single SPFx solution. These webparts will share the common node_modules folder of the SPFx solution. Reference link: https://www.c-sharpcorner.com/article/add-multiple-webparts-to-single-spfx-solution-using-yeoman/


2

Hi here you go this should work, after you run bellow command: Step-1: npm install @microsoft/generator-sharepoint --save-dev you should run the following command: Step-2: yo @microsoft/sharepoint Step-3: gulp trust-dev-cert Make sure you allow access when popups come step-5: gulp serve


2

This is standard behaviour and the best approach for various reasons. Each project (which can include 1 or more webparts) needs to have a node_modules folder. This ensures that who ever builds your project will have the same exact result. Global modules are not declared at the project level, which could open the possibility for issues related to module ...


2

Fixed by running: npm cache clear --force


2

With SPFx solutions, none of the npm packages are deployed to SharePoint, so you can ignore these audit warnings. If you had a custom solution that did deploy the npm packages themselves, yes you'd need to address it. Don't be alarmed by vulnerabilities after running NPM Install


1

This is a computability issue. SharePoint Framework (SPFx) 1.7.1 requires the following node.js LTS 8.x npm v5, v6 yeoman yo@3.1.1. (for creating new projects only) This is what you have. It won't work node.js v14.17.0 npm: v6 (guessing here) yeoman yo@4.3.0. (for creating new projects only) You can fix this issue by following these steps Uninstall node....


1

It looks like it is bug in visual studio code or may be in yomean or may be in typescript because when I run gulp serve it compile web part and resolve the issue by it self. Hope this can help someone else.


1

In IReactSpfxProps.ts file: import { WebPartContext } from "@microsoft/sp-webpart-base"; export interface IReactSpfxProps { description: string; context: WebPartContext; } WebPart.ts: import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { ...


1

@microsoft/sp-build-web should be installed when you run npm install the first time. In package.json, this is referenced in the devDependencies section: "devDependencies": { "@microsoft/sp-build-web": "1.4.1", "@microsoft/sp-module-interfaces": "1.4.1", "@microsoft/sp-webpart-workbench": "1.4.1", "@types/chai": "3.4.34", "@types/mocha": ...


1

Have you added C:\Program Files\nodejs to your PATH environment variable ? Follow the steps below :- Search for the Environment Variables Once you locate them Click on Edit Environment Variables. Click "Environment Variables" . In the "System Variables" option, search for "Path" and edit it by including C:\Program Files\nodejs. Make sure it is ...


1

Try running npm install --save-dev gulp instead of npm install --save-dev gulp-install


1

Install SharePoint Feature Pack 2 from here: security update for SharePoint Server 2016: September 12, 2017 This update allows SPFX Development in SharePoint 2016 on-premise.


1

Not really sure why GetWebUrlFromPageUrl is not working. But as you mentioned in the comment that you want the current sp web url, you can use the this.context.pageContext object. No need to make a REST api call to get the current sp web url. For example, in the render method, using React, it is available as below: public render(): void { const element: ...


Only top voted, non community-wiki answers of a minimum length are eligible