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

Argument of type 'SPHttpClientConfiguration' is not assign able to parameter of type 'SPHttpClientConfiguration'. #911

Closed
cohenpts opened this issue Oct 5, 2017 · 16 comments

Comments

@cohenpts
Copy link

@cohenpts cohenpts commented Oct 5, 2017

Category

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

Unable to Build my SharePoint solution.
When building each of my webparts has the error

"Argument of type 'SPHttpClientConfiguration' is not assign able to parameter of type 'SPHttpClientConfiguration'."

all my sharepoint module imports are the same in all webparts:

import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http';
import { Version, Environment, EnvironmentType } from '@microsoft/sp-core-library';
import {
  BaseClientSideWebPart,
  IPropertyPaneConfiguration,
  PropertyPaneTextField
} from '@microsoft/sp-webpart-base';

Package,json

  "dependencies": {
    "@microsoft/sp-core-library": "~1.3.0",
    "@microsoft/sp-http": "^1.3.0",
    "@microsoft/sp-webpart-base": "~1.3.0",
    "@types/webpack-env": ">=1.12.1 <1.14.0",
    "sp-client-custom-fields": "^1.3.4"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "~1.3.0",
    "@microsoft/sp-module-interfaces": "~1.3.0",
    "@microsoft/sp-webpart-workbench": "~1.3.0",
    "@types/chai": ">=3.4.34 <3.6.0",
    "@types/mocha": ">=2.2.33 <2.6.0",
    "gulp": "~3.9.1",
    "tslint": "^5.7.0",
    "url-loader": "^0.5.9"
  }

Tried removing node_modules and installing a few times and still experiencing the same issue.
thanks in advance.

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Oct 5, 2017

Could you please check two things?

  1. Remove @microsoft/sp-http from the dependencies. If you create a new project using the SPFx generator, it isn't listed there directly
  2. Temporarily remove sp-client-custom-fields from your project and see if it helps. It seems that the currently available package has been built using an older version of the SharePoint Framework and it might be incompatible with the v1.3 you're using in your project
@cohenpts

This comment has been minimized.

Copy link
Author

@cohenpts cohenpts commented Oct 5, 2017

@waldekmastykarz thanks for the quick response.

Removed both sp-http and sp-client-custom-fields.
Now I am getting the error.

Cannot find module '@microsoft/sp-http'

Do I need to have a special reference declaration when doing

import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http';
@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Oct 10, 2017

@cohenpts have you removed @microsoft/sp-http from package.json or did you run npm uninstall @microsoft/sp-http --save-dev?

What I meant by removing is, to remove the reference to it from package.json and restoring dependencies.

@cohenpts

This comment has been minimized.

Copy link
Author

@cohenpts cohenpts commented Oct 11, 2017

I copied the node modules folder from a new yeoman scaffold and haven't been able to reproduce the issue.

Appreciate the help

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Oct 13, 2017

@cohenpts if the issue is solved, could you please close it? Thanks! 🙂

@iclanton

This comment has been minimized.

Copy link
Contributor

@iclanton iclanton commented Oct 16, 2017

It's been a few days, so we're going to go ahead and close this issue. If you see this again, can you reopen this? Thanks!

@runmotion

This comment has been minimized.

Copy link

@runmotion runmotion commented Oct 24, 2018

Hi, I have the same problem. What can I do to solve the issue? Copying the modules folder from a new yeoman scaffold does not work.

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Nov 18, 2018

@runmotion have you by any chance updated your project recently? If so, try running npm dedupe and see if it helps.

@aslanovsergey

This comment has been minimized.

Copy link

@aslanovsergey aslanovsergey commented Dec 17, 2018

@waldekmastykarz npm dedupe helped when updated my project to 1.7 but later when I transformed it into -plusbeta replacing packages names in package.json the npm dudupe command didn't help anymore

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Dec 17, 2018

After replacing package versions in package.json, did you remove the package-lock.json file and run npm install again?

@aslanovsergey

This comment has been minimized.

Copy link

@aslanovsergey aslanovsergey commented Dec 17, 2018

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Dec 18, 2018

Did you also remove node_modules?

@aslanovsergey

This comment has been minimized.

Copy link

@aslanovsergey aslanovsergey commented Dec 18, 2018

Sure

@waldekmastykarz

This comment has been minimized.

Copy link
Member

@waldekmastykarz waldekmastykarz commented Dec 18, 2018

And it still doesn't work? Have you tried creating a new project and comparing what's different?

@kodofix

This comment has been minimized.

Copy link

@kodofix kodofix commented Jan 10, 2019

@waldekmastykarz I just update dependencies to 1.7.1 version and I had the same problem with @microsoft/sp-http but npm dedupe actually works for me and fix problem.

Thanks for help.

@PieterHeemeryck

This comment has been minimized.

Copy link

@PieterHeemeryck PieterHeemeryck commented Aug 16, 2019

Could you please check two things?

  1. Remove @microsoft/sp-http from the dependencies. If you create a new project using the SPFx generator, it isn't listed there directly
  2. Temporarily remove sp-client-custom-fields from your project and see if it helps. It seems that the currently available package has been built using an older version of the SharePoint Framework and it might be incompatible with the v1.3 you're using in your project

The first suggestion resolved my issue. SPFx 1.8.2, node v10 (copied over a project, did not start a new one using yeoman).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.