You may be using pnpjs v3.x
Your code seems to be
valid for v2.x, in v3.x there are changes (global "sp" object has
been deprecated).
To install the previous version (v2.x) that is known
to be compatible with the SPFx examples you seem to be using, try specifying
the version explicitly:
npm uninstall @pnp/sp
then run below command
npm i @pnp/sp@2.11.0
No comments:
Post a Comment