Closed Ofer-Gal closed 11 months ago
Everything looks correct to me, and I can't reproduce your issue.
To better understand what's wrong, can you give us following info: OS SPFx? (if so what version), Node.js version SharePoint version (Online, 2019, 2016,...)
OS win 11 SPFx 1.17.2 (React 17.0.1) node v16.19.0 SharePoint Online gulp serve Shows
[16:39:09] Error - [webpack] 'dist':
./lib/hooks/useSPProject.js
Module not found: Error: Can't resolve '@pnp/sp-admin' in 'D:\DATA\Sources\Repos\Ace3.0\Ace3OneJobScreen\lib\hooks'
resolve '@pnp/sp-admin' in 'D:\DATA\Sources\Repos\Ace3.0\Ace3OneJobScreen\lib\hooks'
Did you install the package in your package.json?
Oops No. I am used to everything in the 2
I'm assuming you understand that the package is really not intended for SPFx solutions. In that you need to be a SharePoint Admin for them to work. I suppose if you were going to write an admin dashboard or something, but the general idea was for nodejs "server" apps, i.e. automation scenarios.
No I did not and thanks for the warning. I was just looking for a way to get the site's name from its URL. (for any user) Guess, this isn't the way to do it then.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
Major Version
3.x
Minor Version Number
21
Target environment
SharePoint Framework
Additional environment details
The example in https://pnp.github.io/pnpjs/sp-admin/#siteproperties shows:
But there is an error "Can't resolve '@pnp/sp-admin'" Is the error in the documentation or the library? Thanks
Expected or Desired Behavior
Tring to get Site Name from SharePoint
Observed Behavior
error "Can't resolve '@pnp/sp-admin'"
Steps to Reproduce
import "@pnp/sp-admin";