我首先删除了旧版本的grunt,然后我安装了新的grunt版本,然后我收到了这个错误:
D:\ www\grunt-test\grunt grunt-cli:grunt命令行界面.(v0.1.4)
致命错误:无法找到当地的咕噜声.
如果您看到此消息,则表示未找到Gruntfile或者您的项目未在本地安装grunt.有关安装和配置grunt的更多信息,请参阅"入门指南":http://gruntjs.com/getting-started
这是因为我的系统路径中没有对grunt的引用吗?或者是其他东西?我试过几次重新安装它.
我尝试实现一些使用的代码promise,并从Ghost复制了一些源代码.但当我运行它时,我收到一个错误:
代码:
var Promise = require('bluebird')
var fs = require('fs')
var path = require('path')
var configPath = path.join(__dirname, '/config-example.js')
var configFile
function writeConfigFile(){
return new Promise(function(resolve,reject){
var read,
write,
error;
console.log('path->', configPath)
read = fs.createReadStream(configPath);
read.on('error', function(err){
console.log('Error->', err);
reject(err)
})
write = fs.createWriteStream(configFile)
write.on('error', function(err){
console.log('Error->',err)
reject(err)
})
write.on('finish', resolve)
read.pipe(write)
});
}
var p = writeConfigFile();
p.then(function(data){
console.log(data)
},function(data){
console.log('data->',data)
});
Run Code Online (Sandbox Code Playgroud)
错误输出
path-> /mnt/share/Learn/config-example.js
data-> [TypeError: path must be a string]
Error-> { [Error: ENOENT, open …Run Code Online (Sandbox Code Playgroud) var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(80, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Run Code Online (Sandbox Code Playgroud)
所以,如果我想听192.168.1.100,就像这样?
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(80, '127.0.0.1').listen(80,'192.168.1.100');
Run Code Online (Sandbox Code Playgroud) HTML:
<div class="a" style="width:auto;...."> //I wanna add some inline-style to overwrite some stylesheet here.
<div class="a">child</div>
<div class="a">child</div>
</div>
<div class="a">
<div class="a">child</div>
<div class="a">child</div>
</div>
Run Code Online (Sandbox Code Playgroud)
正如你在上面看到的那样,我想要绘制与子div具有相同className的父div,我该怎么做?
这是我的代码:
var get_div_a = $('div.a');
var len = get_div_a.size();
var arr = [];
for(var i = 0; i < len ; i++){
if($(get_div_a[i]).children('div.a')!==0){
...no idea ???
}
}
Run Code Online (Sandbox Code Playgroud)