sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Error while calling sphttpclient SPFX extension

Open JS2Code opened this issue 8 years ago • 12 comments

Just following the SP starter kit code for adding the footer menu. This error is occurring in SPTaxonomyService and SPUserProfileService.

Category

  • [x] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Observed Behavior

[21:27:31] Error - typescript - src\services\SPTaxonomyService.ts(46,13): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((url: string, configuration: SPHttpClientConfiguration, options: ISPHttpClientOptions) => Promis...' has no compatible call signatures.

Package.json

{ "name": "footer", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "build:dev": "gulp clean && gulp bundle && gulp package-solution", "build:prod": "gulp clean && gulp bundle --ship && gulp package-solution --ship", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/decorators": "1.5.0", "@microsoft/sp-application-base": "1.5.0", "@microsoft/sp-core-library": "1.5.0", "@microsoft/sp-dialog": "1.5.0", "@microsoft/sp-office-ui-fabric-core": "^1.5.1", "@microsoft/sp-webpart-base": "~1.4.1", "@pnp/common": "^1.0.4-4", "@pnp/logging": "^1.0.4-4", "@pnp/odata": "^1.0.4-4", "@pnp/sp": "^1.1.4", "@pnp/spfx-controls-react": "1.4.0", "@pnp/spfx-property-controls": "1.7.0", "@types/react": "15.6.6", "@types/react-dom": "15.5.6", "@types/es6-promise": "0.0.33", "@types/webpack-env": "1.13.1", "office-ui-fabric-core": "^9.6.0", "react": "15.6.2", "react-dom": "15.6.2", "@microsoft/sp-listview-extensibility": "~1.4.1" }, "devDependencies": { "@microsoft/sp-build-web": "1.5.0", "@microsoft/sp-module-interfaces": "1.5.0", "@microsoft/sp-webpart-workbench": "1.5.0", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }

JS2Code avatar Aug 23 '18 16:08 JS2Code

First, ensure that all your @microsoft/sp-??? dependencies are on the same version. You have a mix of 1.4.1, 1.5.0 and 1.5.1. Then remove the node_modules folder and package-lock.json and run npm install.

wictorwilen avatar Aug 23 '18 19:08 wictorwilen

Wictor,

Will do the changes and let you know

On Fri 24 Aug, 2018, 1:10 AM Wictor Wilén, [email protected] wrote:

First, ensure that all your @microsoft/sp-??? dependencies are on the same version. You have a mix of 1.4.1, 1.5.0 and 1.5.1. Then remove the node_modules folder and package-lock.json and run npm install.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SharePoint/sp-dev-docs/issues/2408#issuecomment-415545913, or mute the thread https://github.com/notifications/unsubscribe-auth/Ae2rzTxVJwC19PqRWaQG-MYjZPILnJGFks5uTwUcgaJpZM4WJ1Pg .

JS2Code avatar Aug 24 '18 02:08 JS2Code

I have updated the to correct versions now I am getting a different error.

here is my package.json

{ "name": "share-point-portal-showcase", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "build:dev": "gulp clean && gulp bundle && gulp package-solution", "build:prod": "gulp clean && gulp bundle --ship && gulp package-solution --ship", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/decorators": "~1.4.1", "@microsoft/sp-application-base": "~1.4.1", "@microsoft/sp-core-library": "~1.4.1", "@microsoft/sp-dialog": "~1.4.1", "@microsoft/sp-lodash-subset": "~1.4.1", "@microsoft/sp-office-ui-fabric-core": "~1.4.1", "@microsoft/sp-webpart-base": "~1.4.1", "@pnp/common": "^1.0.4-4", "@pnp/logging": "^1.0.4-4", "@pnp/odata": "^1.0.4-4", "@pnp/sp": "^1.0.4-4", "@pnp/spfx-controls-react": "1.4.0", "@pnp/spfx-property-controls": "1.7.0", "@types/react": "15.6.6", "@types/react-dom": "15.5.6", "@types/webpack-env": ">=1.12.1 <1.14.0", "react": "15.6.2", "react-dom": "15.6.2", "@microsoft/sp-listview-extensibility": "~1.4.1" }, "devDependencies": { "@microsoft/sp-build-web": "~1.4.1", "@microsoft/sp-module-interfaces": "~1.4.1", "@microsoft/sp-webpart-workbench": "~1.4.1", "@types/chai": ">=3.4.34 <3.6.0", "@types/mocha": ">=2.2.33 <2.6.0", "ajv": "~5.2.2", "gulp": "~3.9.1" } }

tsconfig.json

{ "compilerOptions": { "target": "es5", "forceConsistentCasingInFileNames": true, "module": "commonjs", "jsx": "react", "declaration": true, "sourceMap": true, "experimentalDecorators": true, "skipLibCheck": true, "typeRoots": [ "./node_modules/@types", "./node_modules/@microsoft" ], "types": [ "es6-promise", "webpack-env" ], "lib": [ "es5", "dom", "es2015.collection" ] } }

image

JS2Code avatar Aug 24 '18 05:08 JS2Code

After updating your dependency versions in package.json, have you deleted the node_modules folder and re-run npm install?

waldekmastykarz avatar Aug 25 '18 11:08 waldekmastykarz

Yes I did.

On Sat 25 Aug, 2018, 4:52 PM Waldek Mastykarz, [email protected] wrote:

After updating your dependency versions in package.json, have you deleted the node_modules folder and re-run npm install?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SharePoint/sp-dev-docs/issues/2408#issuecomment-415962627, or mute the thread https://github.com/notifications/unsubscribe-auth/Ae2rzUEQMcqqv1AvDTeirg2vsR6uL6TXks5uUTOCgaJpZM4WJ1Pg .

JS2Code avatar Aug 25 '18 13:08 JS2Code

If you create a new project and move your code there, can you reproduce the error?

waldekmastykarz avatar Aug 27 '18 17:08 waldekmastykarz

Just to provide some feedback as I got this error yesterday and resolved it using the same steps as suggested on this thread. @Shamrh did you try the steps above to update your dependencies and re-install the entire node_modules folder?

joelfmrodrigues avatar Oct 29 '18 09:10 joelfmrodrigues

What also helps is to run npm dedupe which prevents you from having to remove the node_modules folder and the lock file.

waldekmastykarz avatar Nov 18 '18 20:11 waldekmastykarz

Added labels to prompt for follow up, or to close stale issue.

andrewconnell avatar Feb 20 '19 20:02 andrewconnell

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

msft-github-bot avatar Feb 27 '19 21:02 msft-github-bot

Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently.

msft-github-bot avatar Mar 06 '19 22:03 msft-github-bot

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 27 '20 00:01 msft-github-bot