Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error - Upgrading to SPFx 1.19.0 #1846

Open
akshataggrwal opened this issue Jul 4, 2024 · 9 comments · Fixed by #1857
Open

Error - Upgrading to SPFx 1.19.0 #1846

akshataggrwal opened this issue Jul 4, 2024 · 9 comments · Fixed by #1857
Labels
status:fixed-next-drop Issue will be fixed in upcoming release.
Milestone

Comments

@akshataggrwal
Copy link

akshataggrwal commented Jul 4, 2024

Issue Description
We are trying to upgrade our SPFx solutions to the latest SPFx version 1.19.0. However, while upgrading, we are facing issues with some of our existing project dependencies - @pnp/spfx-controls-react (3.x.x) and/or @pnp/spfx-property-controls (3.x.x). The issue is when we do gulp bundle or gulp serve, it fails with the error as shown in the below screenshot.

image

What we have tried so far
We found that there is an ongoing issue in the sp-dev-docs - SharePoint/sp-dev-docs#9675

We tried solutions/workarounds suggested in that issue thread, and one of those worked for us. Which is using beta versions of above mentioned packages. However, we are not keen on using beta packages in our solutions

"@pnp/spfx-controls-react": "4.0.0-beta.6059083",
"@pnp/spfx-property-controls": "4.0.0-beta.6059131"

Additional Environment Details
• Node version: 18.20.3
• SPFx version: 1.19.0

cc - @AJIXuMuK

Copy link

github-actions bot commented Jul 4, 2024

Thank you for submitting your first issue to this project.

@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Jul 4, 2024

Will take a look. Thanks for reporting!

@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Jul 5, 2024

@akshataggrwal - I'm not seeing any such issues with React controls library v 3.18.1.
what component are you exporting?

@JRRSG
Copy link

JRRSG commented Jul 9, 2024

@akshataggrwal - I'm not seeing any such issues with React controls library v 3.18.1. what component are you exporting?

I am also getting this error. I started a clean form customizer solution, installed @pnp/spfx-controls-react v3.18.1 and immediately encountered this error. Removing @pnp/spfx-controls-react gets rid of the error.

Screenshot 2024-07-09 171848

@akshataggrwal
Copy link
Author

@AJIXuMuK the issue is happening when I am using pnpm, with npm and with latest versions of the below packages it works fine.
"@pnp/spfx-controls-react": "3.18.1",
"@pnp/spfx-property-controls": "3.17.1"

Any thoughts on why pnpm may be causing the issue ?

@JRRSG
Copy link

JRRSG commented Jul 11, 2024

@AJIXuMuK the issue is happening when I am using pnpm, with npm and with latest versions of the below packages it works fine. "@pnp/spfx-controls-react": "3.18.1", "@pnp/spfx-property-controls": "3.17.1"

Any thoughts on why pnpm may be causing the issue ?

Thanks, using pnpm was causing it. I had tried compiling just this package by itself, and still got errors. I isolated the problem to coming from the Adaptive Card control and deleting those related folders got rid of all the errors but 1. The last error came back saying this:

{ "message": "External \"@microsoft/microsoft-graph-client\" has an unresolved version.", "stack": "Error: External \"@microsoft/microsoft-graph-client\" has an unresolved version at [[ManifestPlugin._getExternalsScriptResourcesAsync]] (C://Users//---//source//repos//sp-dev-fx-controls-react//node_modules//.pnpm//@[email protected]_@[email protected]_@[email protected]_webpack-cli@4_75suntshj4gmifjtbemncqmx5y//node_modules//@microsoft//spfx-heft-plugins//lib//spfxManifests//webpack//ManifestPlugin.js:215:31) at async [[ManifestPlugin._generateLoaderConfigurationAsync]] (C://Users//---//source//repos//sp-dev-fx-controls-react//node_modules//.pnpm//@[email protected]_@[email protected]_@[email protected]_webpack-cli@4_75suntshj4gmifjtbemncqmx5y//node_modules//@microsoft//spfx-heft-plugins//lib//spfxManifests//webpack//ManifestPlugin.js:172:33) at async C://Users//---//source//repos//sp-dev-fx-controls-react//node_modules//.pnpm//@[email protected]_@[email protected]_@[email protected]_webpack-cli@4_75suntshj4gmifjtbemncqmx5y//node_modules//@microsoft//spfx-heft-plugins//lib//spfxManifests//webpack//ManifestPlugin.js:105:57" }

I took your advice and switched to npm and it compiled. I don't know enough to be able to dig any further than this, but hopefully this can help the devs isolate what might be going on and if it's actually pnpm's fault or if something isn't being referenced correctly and npm is able to just ignore it and pnpm can't.

@timdhahn
Copy link

timdhahn commented Jul 30, 2024

@AJIXuMuK - Are there plans to update spfx to 1.19?

I have been using pnpm in my spfx projects for the past few years without any issues. I get the same error as @JRRSG. However I was able to resolve it by using "peerDependencies" in package.json.

It looks like the issue stems from sp-dev-fx-controls-react being on 1.18.2. For some reason pnpm is having issues and I'm thinking that is because of the webpack 5 changes in 'gulp bundle' (as this wasn't causing issues before).

Here is what I went through to fix the issue

Trying to bundle our project throws an error: [object object].
When you make a change to see the error (SharePoint/sp-dev-docs#9675 (comment)). The same error that @JRRSG mentioned

Now, looking back to when you do a pnpm install it gives you a list of unmet peer dependencies which is a clue to solving the issue.
image

The culprit
If we search for that package:
pnpm ls "*sp-http-msgraph" -r --depth Infinity

We find 1.18.2 is being referenced by @pnp/spfx-property-controls & @pnp/spfx-controls-react
image
image

Solution
Adding "peerDependencies" and the needed version of @microsoft/sp-http-msgraph solves this issue.
image

Hopefully this helps people having this issue, but keeping the versions synchronized might alleviate extra work and trouble shooting needed.

@AJIXuMuK AJIXuMuK mentioned this issue Aug 1, 2024
@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Aug 1, 2024

Support for SPFx 1.19.0 has been added in the latest beta - check it out.

@timdhahn
Copy link

timdhahn commented Aug 6, 2024

Thanks @AJIXuMuK. I'm able to build successfully now with pnpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants