3

I have done the following:

  • ran jspm install aurelia-http-client
  • set up gulp to package my framework JavaScript.
  • ran gulp bundle
  • checked the resulting file, and it now contains aurelia-http-client and the correct version number.
  • I have ReSharper v2016.2.2 installed
  • I have TypeScript v2.0.3 installed

Aurelia with bindings and everything works fine.

This part here is what's cause me a headache

import { HttpClient } from 'aurelia-http-client';

There is a read squiggly line under 'aurelia-http-client', and if i try to build i get the error message from the title.

When I tried to get aurelia-fetch-client to work i had to do some typings magic, and finally it wanted to work, but i can't find anyone who uses typings for aurelia-http-client. It seems it just works for most people.

Anyone know how to fix this?

Bjørn
  • 1,138
  • 2
  • 16
  • 47
  • Are you using the CLI? – Brandon Oct 28 '16 at 21:15
  • If you're using the CLI, you need to be using NPM and not JSPM. Also, you may have to run the typings install on it. Make sure that you have it in your aurelia.json file dependencies. – Brandon Oct 28 '16 at 21:25
  • I don't have an aurelia.json file, I do have a config.js, gulpfile.js, jsconfig.json and i also had typings.json for a while. I needed it to get 'aurelia-fetch-client' to work locally, but i could not get that to build on the build server... it got lots of 'Promise' and 'IterableIterator' errors (Cannot find name versions) from whatwg-fetch\index.d.ts... – Bjørn Oct 31 '16 at 07:00

2 Answers2

3

if you are using NPM

npm install aurelia-http-client

or

npm install aurelia-fetch-client

you can see the difference between http-client and fetch-client from this issue

https://github.com/aurelia/fetch-client/issues/7

Abdelrahman Gobarah
  • 1,544
  • 2
  • 12
  • 29
1

Install the HTTPClient yarn add aurelia-http-client

Or if you prefer.. yarn add aurelia-fetch-client

noelmcloughlin
  • 1,723
  • 1
  • 12
  • 10