Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 }
like image 255
Celeste Avatar asked Aug 10 '16 13:08

Celeste


2 Answers

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.

like image 178
Fabricio Nogueira Avatar answered Oct 13 '22 00:10

Fabricio Nogueira


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"

like image 40
vishalbasnet23 Avatar answered Oct 12 '22 23:10

vishalbasnet23