Aurelia no such file or directory aurelia-fetch-client.js

I am new to Aurelia and am involved in building code snippets.

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 received 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 } 
+6
source share
2 answers

If you use the Aurelia CLI to create your project, install using a npm aurelia-fetch-client.

 $ npm install aurelia-fetch-client --save 

if you are using a basic Unix system (mac or linux), I think that Windows can have the same command.

Inside your project, in the aurelia_project folder in the aurelia.json file, add the following lines:

 { "name": "aurelia-fetch-client", "path": "../node_modules/aurelia-fetch-client/dist/amd", "main": "aurelia-fetch-client" } 

In my case, I put in a set of tags, for example.

 "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.

+6
source

First you need to install npm aurelia-fetch-client. After that, you need to go to the aurelia_project / aurelia.json file and add the following to the dependency section:

"Aurelia-client sampling"

+4
source

All Articles