我使用以下命令安装了nodejs:
apt-get install nodejs
Run Code Online (Sandbox Code Playgroud)
然后我使用以下命令安装了npm:
apt-get install npm
Run Code Online (Sandbox Code Playgroud)
然后我永远安装使用:
npm install forever -g
Run Code Online (Sandbox Code Playgroud)
现在我去我的项目 /var/www/myproject
并试图运行 forever start server.js
然后我收到以下消息:
/usr/bin/env: node: No such file or directory
Run Code Online (Sandbox Code Playgroud)
谁能告诉我发生了什么事?
到目前为止,我已经node.js
通过以下方式创建了类和模块:
var fs = require('fs');
var animalModule = (function () {
/**
* Constructor initialize object
* @constructor
*/
var Animal = function (name) {
this.name = name;
};
Animal.prototype.print = function () {
console.log('Name is :'+ this.name);
};
return {
Animal: Animal
}
}());
module.exports = animalModule;
Run Code Online (Sandbox Code Playgroud)
现在使用ES6,您可以像这样制作"实际"类:
class Animal{
constructor(name){
this.name = name ;
}
print(){
console.log('Name is :'+ this.name);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,首先,我喜欢这个:)但它提出了一个问题.你如何结合node.js
模块结构使用它?
假设您有一个课程,您希望使用模块,以便演示说您想使用 fs
所以你创建你的文件:
Animal.js
var fs = require('fs');
class Animal{
constructor(name){ …
Run Code Online (Sandbox Code Playgroud) 我一直在研究这个问题,但至少我还是非常困惑.
谁能给我一个何时使用Task
和何时使用的具体例子Platform.runLater(Runnable);
?究竟有什么区别?什么时候使用其中任何一个是否有黄金法则?
如果我错了也不纠正我,但这两个"对象"不是在GUI中用于更新GUI的主线程内创建另一个线程的方法吗?
我有一个表的下面的sequelize定义:
AcademyModule = sequelize.define('academy_module', {
academy_id: DataTypes.INTEGER,
module_id: DataTypes.INTEGER,
module_module_type_id: DataTypes.INTEGER,
sort_number: DataTypes.INTEGER,
requirements_id: DataTypes.INTEGER
}, {
freezeTableName: true});
Run Code Online (Sandbox Code Playgroud)
如您所见id
,此表中没有列.但是,当我尝试插入它仍然尝试以下sql:
INSERT INTO `academy_module` (`id`,`academy_id`,`module_id`,`sort_number`) VALUES (DEFAULT,'3',5,1);
Run Code Online (Sandbox Code Playgroud)
如何禁用id
它清楚的功能?
所以我已经下载了select2我已经"安装它"将它放入我的文件夹,然后当我检查控制台(我可以看到所有正在加载的脚本)时将其加载到我的网站上我可以看到文件select2.js
我去了他们的文档并将其复制并添加 $("#e9").select2();
但是,当我加载页面时,我收到以下错误:
TypeError: $(...).select2 is not a function
$("#e9").select2();
Run Code Online (Sandbox Code Playgroud)
有没有其他人体验这样的事情?
这里的其他信息是我的脚本:
jQuery(document).ready(function(){
var max_amount = parseFloat($('#max_amount').val());
$( "#item_amount" ).keyup(function() {
if($(this).val() > max_amount){
$(this).val( max_amount);
}
if( /\D/.test($(this).val()) ){
alert('Må kun indeholde tal!');
$(this).val('');
}
if($(this).val()== '0'){
alert('Må ikke være 0!');
$(this).val('');
}
});
$("#e1").select2();
});
function addToBasket(){
var amount = $('#item_amount').val();
if(amount == ""){
amount = 1;
}
if(amount > 0){
$.ajax({
type: 'POST',
url: myBaseUrl + 'Products/addItemToBasket',
dataType: 'json',
data: {
id: window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1),
amount: …
Run Code Online (Sandbox Code Playgroud) 我的angular
应用程序现在不断变化,因为我们的团队现在正在快速更新.
由于缓存,我们的客户并不总是拥有我们代码的最新版本.
那么有一种方法angular
可以强制浏览器清除缓存吗?
正如您在图片中看到的那样,每个列的文本对齐方式设置为左对齐.有没有办法改变这个?到目前为止,我已经在我的CSS文件中尝试过:
#Cols{
text-align: right;
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
#Cols{
-fx-text-alignment: right;
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何改变对齐方式?
我使用sequelize作为我的后端ORM.现在我想做一些日期操作.
更多Speceficly我想获得所有数据,其中的日期是从现在开始,7天后.
问题是文档没有指定您可以执行哪些操作 Datatypes.DATE
谁能指出我正确的方向?
我想成为一个优秀的小程序员并使用可用于编码JavaScript的新工具.因此,我试图使用let
而不是var
隔离变量.
这在我的浏览器中工作正常但是PhpStorm将其视为错误,当我在其上方悬停时它给了我:
当前的JavaScript版本不支持定义
所以我的问题是如何升级当前的JavaScript版本?
好的,所以我使用FileUploader
模块将我的文件从angular上传到我的REST API
:
var uploader = $scope.uploader = new FileUploader({
url: api.getUrl('uploadCompetence',null)
});
Run Code Online (Sandbox Code Playgroud)
这将发送到以下POST
功能:
router.route('/api/uploadCompetence')
.post(function (req, res) {
// This is where i want to read the file
var competence = Competence.build(req.body.location);
competence.add(function (success) {
res.json({message: 'quote created!'});
},
function (err) {
res.status(err).send(err);
});
})
Run Code Online (Sandbox Code Playgroud)
现在我的目标是读取excel
文件,然后将每一行添加到我的数据库.
但是,我不太确定我如何从Node.js
我调试我的服务器读取文件,无法在任何地方找到该文件,但从我的Angular
应用程序调用api
任何人都可以把我推向正确的方向吗?:)