最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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 }

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 }
Share Improve this question asked Aug 10, 2016 at 13:33 CelesteCeleste 972 silver badges14 bronze badges 2
  • 2 I figured out the problem. Need to add "es7.decorators" under config.js for babeloptions. – Celeste Commented Aug 11, 2016 at 14:13
  • Please post your ment as the answer to your question, so that others can more easily find it and also upvote it if it's useful for them :-) – Oliver Commented Oct 7, 2016 at 13:02
Add a ment  | 

2 Answers 2

Reset to default 6

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

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"

发布评论

评论列表(0)

  1. 暂无评论