Spfx commands(setup, develop and deploy)

Setup environment 


1. Install Gulp => npm install gulp-cli --global

 

   check version =>gulp -v


2. Install Yeoman => npm install yo --global

   if already exist add --force


3. Install Yeoman SharePoint generator

    => npm install @microsoft/generator-sharepoint --global


4. Trusting the self-signed developer certificate

   => gulp trust-dev-cert


5. Check the version of globally installed packages

=> npm list --global --depth=0️


6. check framework version

=> npm ls -g --depth=0


------------------------------------------------------------------------------------------------------


Setup application


1. create folder 


2. Yeoman SharePoint Generator => yo @microsoft/sharepoint


3. run application in local host => gulp serve --nobrowser


4. update the initial page url from serve.json under config folder


=> https://.../_layouts/workbench.aspx


5. run application the application => gulp serve

-----------------------------------------------------------------------------------------------------

Reconfigure the environment

delete the "npm" and "npm-cache" file from below path and install the the node...

C:\Users\sentk\AppData\Roaming\

------------------------------------------------------------------------------------------------------

Deployment 

gulp clean

1. gulp bundle --ship

2. gulp package-solution --ship


Note: The JavaScript files, CSS, and other assets are packaged in the package when the --ship option is used.


----------------------------------------------------------------------------------------------------------------

spfx compatability


https://learn.microsoft.com/en-us/sharepoint/dev/spfx/compatibility

SPFx Node.js (LTS) NPM TypeScript React

1.15.2 v12, v14, v16 v5, v6, v7, v8 v4.5 v16.13.1


-----------------------------------------------------------------------------------------------------------------------

if node version mismatch from source code to installed version 


nvm install 8.11.0

-----------------------------------------------------------------------------------------------------------------------

Uninstall packages

npm uninstall @microsoft/{spfx-package-name}@1.17.x


generator-sharepoint@1.18.0


npm uninstall @microsoft/generator-sharepoint@1.18.0

npm uninstall @microsoft/generator-sharepoint@1.17.x


npm uninstall @microsoft/generator-sharepoint@1.18.0

npm uninstall -g @microsoft/generator-sharepoint

npm install -g @microsoft/generator-sharepoint@1.15.0


npm ls -g --depth=0 


@microsoft/generator-sharepoint


npm install @microsoft/{spfx-package-name}@1.14.0 --save --save-exact

Comments

Popular posts from this blog

SPFX setup & deployment

Sites.Selected | Graph API SharePoint Permission

Connect to Azure AD-secured APIs in SPFx