Friday 15 January 2021

SPFX npm commands

 SPFX components:



call npm uninstall -g chalk
call npm uninstall -g loadash
call npm uninstall -g tar-fs
call npm uninstall -g update-notifier
call npm uninstall -g yeoman-generator
call npm uninstall -g yosay
call npm uninstall -g yo
call npm uninstall -g gulp
call npm uninstall -g @microsoft/generator-sharepoint
call npm install -g chalk
call npm install -g loadash
call npm install -g tar-fs
call npm install -g update-notifier
call npm install -g yeoman-generator
call npm install -g yosay
call npm install -g yo
call npm install -g gulp
call npm install -g @microsoft/generator-sharepoint
c:/venu/Md spfx
c:/venu/cd spfx
c:/spfx


yo @microsoft/sharepoint

npm shrinkwrap 


Done..

Next

gulp trust-dev-cert

gulp serve

Code .



npm install jquery --save
npm install @types/jquery --save

How to add jqurey external on config.json?


  1.  



This creates files under temp/deploy  which need to be copied to the Assets folder of your site

  1. gulp build  
  2. gulp -ship


Running the below commands creates sppkg in your target path.
  1. gulp bundle --ship  
  2. gulp package-solution --ship




  1. clean cache with
    npm cache clean --force
  2. install the latest version of npm globally as admin:
    npm install -g npm@latest --force
  3. clean cache with
    npm cache clean --force
  4. Try to install your component once again.>








Developer certificate has to be installed ONLY once in your development environment, so you can skip this step, if you have already executed that in your environment.

gulp trust-dev-cert
Now that we have installed the developer certificate, enter the following command in the console to build and preview your web part:

gulp serve



                                               First Should Know Concepts of SPFX



  1. How to Set up your SharePoint Framework development environment





We can use any code editor -- i.e Visual studio code
Yeoman helps you kick-start new projects'
Yeoman generator for creating new web parts
The generator provides 1. common build tools, 2. common boilerplate code.
Yeoman SharePoint web part generator helps you quickly create a SharePoint client-side solution project.
install the SharePoint Framework Yeoman generator globally
Client-side web parts are client-side components that run inside the context of a SharePoint page




  1. How to setup-node-behind-web-proxy

npm config set proxy http://proxy.company.com:8080
npm config 
set https-proxy http://proxy.company.com:8080