正如我的标题解释我收到以下错误:
{
"errorMessage": "Cannot find module 'index'",
"errorType": "Error",
"stackTrace": [
"Function.Module._resolveFilename (module.js:338:15)",
"Function.Module._load (module.js:280:25)",
"Module.require (module.js:364:17)",
"require (module.js:380:17)"
]
}
Run Code Online (Sandbox Code Playgroud)
我尝试了在创建-la-lambda-function-in-aws-from-zip-file和simple-node-js-example-in-aws-lambda中提供的两种解决方案.
我的index.js处理函数如下所示:
exports.handler = function(event, context) {
Run Code Online (Sandbox Code Playgroud)
还有什么可能导致这个问题,除了上面这两个答案中所述的内容?我已经尝试了两种解决方案,并且我还为该功能分配了更多内存,这就是为什么它无法运行.
编辑 - 为了尝试,我创建了一个更简单的原始代码版本,它看起来像这样:
var Q = require('q');
var AWS = require('aws-sdk');
var validate = require('lambduh-validate');
var Lambda = new AWS.Lambda();
var S3 = new AWS.S3();
theHandler = function (event, context) {
console.log =('nothing');
}
exports.handler = theHandler();
Run Code Online (Sandbox Code Playgroud)
然而仍然无法使用相同的错误?
链接到相关网站:http://qbtei.com/nationalretail/public
在我的fonts.css中,我正在加载一堆字体,如下所示:
@font-face {
font-family: GothamBook;
src: url('../fonts/Gotham-Book.otf');
src: url( ../fonts/Gotham-Book.otf ); /* IE */
}
@font-face {
font-family: GothamBookItalic;
src: url('../fonts/gothambookitalic.otf');
src: url( ../fonts/gothambookitalic.otf ); /* IE */
}
@font-face {
font-family: GothamBold;
src: url('../fonts/gothambold.otf');
src: url( ../fonts/gothambold.otf ); /* IE */
}
Run Code Online (Sandbox Code Playgroud)
在Firefox/chrome这些字体没有问题,但在IE 10中,当我检查元素时,这个css文件显示为空并且字体未加载
我曾尝试使用http://www.fontsquirrel.com/tools/webfont-generator创建一个看起来像这样的新字体css表,但最终无法在firefox,chrome或Internet Explorer中使用
@font-face {
font-family: 'gotham_boldregular';
src: url('gothambold-webfont.eot');
src: url('gothambold-webfont.eot?#iefix') format('embedded-opentype'),
url('gothambold-webfont.woff') format('woff'),
url('gothambold-webfont.ttf') format('truetype'),
url('gothambold-webfont.svg#gotham_boldregular') format('svg');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
我在css中使用我的字体,如下所示:
.nav-text{
font-family: GothamLight;
font-size: 21px;
color: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 superagent 向我的 API 发出多部分 POST 请求。
我的代码:
superagent
.post(apiUrl + '/api/company/profile/edit')
.field("profileData", profileData)
.attach('company_logo', logoFile )
.set('Accept', 'application/json')
.end(function(err, res){
if(err){
dispatch(updateProfileStatusAction("error", res));
} else {
dispatch(updateProfileStatusAction("success", res));
}
});
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是这profileData
是一个嵌套的对象。当我在 API 中收到请求时,我看到 的值profileData
是字符串[Object, Object]
当我查看带有 superagent 的多部分请求的文档https://visionmedia.github.io/superagent/#multipart-requests时,它似乎.field()
只是一个键、值对,而不是一个对象。然后我尝试使用 .send({profileData: profileData}) 而不是字段,但是当我这样做时,我收到一条错误消息,指出 .attach 和 .send 不能在同一请求中一起使用。
只是为了一些背景我使用codeigniter与模板火花.
所以在我的控制器中我有以下功能
public function information()
{
$this->load->library('session');
$developer_id = $this->session->userdata('developer_id');
$this->load->model("Developer_model");
$information = $this->Developer_model->get_developer($developer_id);
$this->template->set('information', (array) $information);
$this->template->build('dashboard/information');
}
Run Code Online (Sandbox Code Playgroud)
在我看来,我是这样回应的
<?php echo $information['email']; ?>
Run Code Online (Sandbox Code Playgroud)
由于某种原因,我回来了"消息:未定义的索引:电子邮件"
这是我的第一个问题,所以希望我不清楚,但基本上我从我的数据库获取$信息并试图回显电子邮件,这只是一系列项目中的一件事.
当我var_dump $信息时,我得到以下内容:
object(stdClass)#21 (2) { ["timestamp"]=> int(1353444880991) ["result"]=> object(stdClass)#22 (3) { ["email"]=> string(21) "anothertest@gmail.com" ["api_key"]=> string(64) "de0f57acfc018882841b3255e89da11cb238160e84a66fe5b45bda8c51137c72" } }
Run Code Online (Sandbox Code Playgroud)
在此之前感谢您的帮助,只有在使用codeigniter 2个月之前我才真正完成了除了一些非常小的html废话之外的编码.所以对我来说很容易= D
我正在尝试按照他们的教程中的描述移动Auth0登录功能.如果我像这样使用它,我能够使它工作:
<button className="btn" onClick={this.props.route.auth.login.bind(this)}>test</button>
Run Code Online (Sandbox Code Playgroud)
但如果我设置按钮来调用一个函数我在上面定义了渲染函数,如下所示:
login() {
this.props.route.auth.login.bind(this);
}
Run Code Online (Sandbox Code Playgroud)
并改变onclick如下:
onClick={this.login()}
Run Code Online (Sandbox Code Playgroud)
要么
onClick={() => this.login()}
Run Code Online (Sandbox Code Playgroud)
然后auth登录模式永远不会打开,我没有收到任何错误.另外我添加了一个console.log
to login()
,我可以在控制台中看到它,但实际的登录模式永远不会打开?它适用于第一个示例,但不适用于其他示例.
我试图将其转换为函数的原因是因为我想稍后将登录函数传递给子组件,而我无法这样做,我相信这是阻止我的根本问题.
在我的react组件中,我有一个视频标签,如下所示:
<video>
<source src="https://fake.com/file.mp4" type="video/mp4" />
</video>
Run Code Online (Sandbox Code Playgroud)
我还有一个按钮可以用来激活视频:
<button onClick={playVideoFunc?}/>
Run Code Online (Sandbox Code Playgroud)
我假设我将使用某种on click事件来触发视频播放,并且我知道我可以使用以下javascript代码来做到这一点:
var v = document.getElementsByTagName("video")[0];
v.play();
Run Code Online (Sandbox Code Playgroud)
但是感觉这是我第一次使用react我想知道是否有更“反应”的方式来做到这一点?另外,如果我必须像上面一样使用纯JavaScript,是否应该将该代码放入react组件本身?供参考,我的组件看起来像这样(减去一些细节):
import React, { Component } from 'react';
import Footer from './footerComponent'
import Navbar from './navbarComponent';
class Home extends React.Component{
render() {
return (
<div className="wrapper home-page">
<div className="jumbotron-video-wrapper">
<video>
<source src="https://fake.com/file.mp4" type="video/mp4" />
</video>
</div>
<Navbar type={"transparent"}/>
<div className="jumbotron margin-bottom-20" style={heroStyle}>
<div className="container-fluid">
<div className="row">
<div className="col-md-8 col-md-offset-2 text-center">
<h1>WORDS WORDS WORDS</h1>
<img onClick={playvideo??} width="130" src={playImage}/>
<p className="thin">Watch our video</p>
</div>
</div> …
Run Code Online (Sandbox Code Playgroud) javascript ×4
node.js ×2
reactjs ×2
ajax ×1
auth0 ×1
aws-lambda ×1
codeigniter ×1
css ×1
font-face ×1
fonts ×1
html5-video ×1
php ×1
superagent ×1