I'm a beginner of Aurelia and learning to put code pieces together.
itemWithPicture.js
import "fetch";
import {HttpClient, json} from "aurelia-fetch-client";
let httpClient = new HttpClient();
export class ItemWithPicture {
constructor() {
this.heading = "Item with Picture";
}
}
The error I got is
{ [Error: ENOENT: no such file or directory, open 'C:\GitRepo\pictureRecord\n
ode_modules\aurelia-fetch-client.js']
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\GitRepo\\pictureRecord\\node_modules\\aurelia-fetch-client.js',
moduleTree: [ 'itemWithPicture' ],
fileName: 'C:/GitRepo/pictureRecord/src/itemWithPicture.js' },
duration: [ 0, 2993168 ],
time: 1470835605761 }
If you use the Aurelia CLI to create your project, install with npm aurelia-fetch-client.
$ npm install aurelia-fetch-client --save
if you use a base Unix system (mac or linux), i think in windows may be the same command.
After, inside your poject, in the folder aurelia_project in the file aurelia.json add these lines:
{
"name": "aurelia-fetch-client",
"path": "../node_modules/aurelia-fetch-client/dist/amd",
"main": "aurelia-fetch-client"
}
In my case, i put inside the tags bundle eg.
"bundles": [
{
...
},
{
"name": "vendor-bundle.js",
...,
"dependencies": [
...
{
"name": "aurelia-fetch-client",
"path": "../node_modules/aurelia-fetch-client/dist/amd",
"main": "aurelia-fetch-client"
} ...
Or something like that.
First you need to npm install aurelia-fetch-client. After that, you need to go into the aurelia_project/aurelia.json file and add the following to the dependencies section:
"aurelia-fetch-client"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With