我是Aurelia的初学者,正在学习将代码片段组合在一起。
itemWithPicture.js
import "fetch";
import {HttpClient, json} from "aurelia-fetch-client";
let httpClient = new HttpClient();
export class ItemWithPicture {
constructor() {
this.heading = "Item with Picture";
}
}
我得到的错误是
{ [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 }
最佳答案
如果使用Aurelia CLI创建项目,请使用npm aurelia-fetch-client进行安装。
$ npm install aurelia-fetch-client --save
如果您使用基本的Unix系统(mac或linux),我认为Windows中的命令可能相同。
之后,在您的项目内部,将aurelia.json文件中的 aurelia_project 文件夹添加以下行:
{
"name": "aurelia-fetch-client",
"path": "../node_modules/aurelia-fetch-client/dist/amd",
"main": "aurelia-fetch-client"
}
就我而言,我将标签包放在例如。
"bundles": [
{
...
},
{
"name": "vendor-bundle.js",
...,
"dependencies": [
...
{
"name": "aurelia-fetch-client",
"path": "../node_modules/aurelia-fetch-client/dist/amd",
"main": "aurelia-fetch-client"
} ...
或类似的东西。
关于javascript - Aurelia没有这样的文件或目录aurelia-fetch-client.js,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38874953/