之后npm init我可以使用这个我的package.json添加依赖关系:
npm install package --save
Run Code Online (Sandbox Code Playgroud)
并说,我想要uninstall包,我这样做:
npm uninstall package
Run Code Online (Sandbox Code Playgroud)
但我希望我的package.json也能相应更新,而不必手动转到该文件并删除该行.
从npm文档中可以看出:
它是严格加法的,因此它不会从package.json中删除选项而没有充分的理由这样做.
所以,我只是想知道这是否可能.
我认为问题是直截了当的.
我正在寻找类似于nodejs V8引擎中的window.performance.now()的东西.
现在我只是使用: -
var now = Date.now();
//do some processing..
console.log("time elapsed:", Date.now() - now);
Run Code Online (Sandbox Code Playgroud)
但是,我读到window.performance.now()比使用日期要准确得多,因为这里定义了什么.
大家好我正在尝试创建架构测试.
PUT /test
{
"mappings": {
"field1": {
"type": "integer"
},
"field2": {
"type": "integer"
},
"field3": {
"type": "string",
"index": "not_analyzed"
},
"field4": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
},
"settings": {
bla
bla
bla
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
{
"error": {
"root_cause": [{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [index : not_analyzed] [type : string]"
}],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [featured]: Root mapping definition has unsupported parameters: [index : not_analyzed] [type …Run Code Online (Sandbox Code Playgroud) 为什么每当我这样做: -
JSON.parse('"something"')
Run Code Online (Sandbox Code Playgroud)
它解析得很好,但是当我这样做时: -
var m = "something";
JSON.parse(m);
Run Code Online (Sandbox Code Playgroud)
它给我一个错误说: -
Unexpected token s
Run Code Online (Sandbox Code Playgroud) 所以,css-grids当我注意到grid-template-areas有一些不同的语法可能与内联反应样式不兼容时,我一直在玩反应.我没有使用任何库只是简单的旧内容样式与样式道具反应.
所以我打算做的就是这个.
.wrapper {
display: grid;
grid-template-columns: 100px 100px;
grid-template-areas: "header header"
"aside main"
"footer footer"
}
.header {
grid-area: header;
border: 1px solid red;
}
.main {
grid-area: main;
border: 1px solid green;
}
.aside {
grid-area: aside
}
.footer {
grid-area: footer;
border: 1px solid yellow;
}
Run Code Online (Sandbox Code Playgroud)
Fidde:https://jsbin.com/lejaduj/2/edit ? html,css,output
布局很简单,"标题"和"页脚"覆盖了所有列,"旁边"和"主要"覆盖了一半.这只是为了演示目的所以我保持简单.
特别注意grid-template-areas多个值是如何用双引号分隔的.
经过一番思考后,我认为我们可以gridTemplateAreas在反应内联样式中使用数组.这似乎不起作用.
我再次尝试过template-literals哪个也没用.
沙箱:https://codesandbox.io/s/zx4nokmr5l
那么,仅仅是我遇到了这个障碍还是尚未得到反应?
我宁愿不使用任何额外的库或框架来尽可能地实现这一点.
我正在学习面向对象的Javascript的一些方面.我遇到了这个片段
var Person = function(firstName, lastName)
{
this.lastName = lastName;
this.firstName = firstName;
};
Object.defineProperties(Person.prototype, {
sayHi: {
value: function() {
return "Hi my name is " + this.firstName;
}
},
fullName: {
get: function() {
return this.firstName + " " + this.lastName;
}
}
});
var Employee = function(firstName, lastName, position) {
Person.call(this, firstName, lastName);
this.position = position;
};
Employee.prototype = Object.create(Person.prototype);
var john = new Employee("John", "Doe", "Dev");
Run Code Online (Sandbox Code Playgroud)
我的问题是:为什么这个代码片段使用Object.create(Person.prototype)?我们不应该简单地重置原型:
Employee.prototype = Person.prototype;
Run Code Online (Sandbox Code Playgroud) 我可能会在这里挑剔,但是当终端没有打开像Chrome这样的应用程序时,它真的很烦人,Sublime Text如果我从终端打开它就把重点放在它上面.我这样做: -
shriek@ubuntu ~ $ subl .
Run Code Online (Sandbox Code Playgroud)
Alt + tab如果我运行多个应用程序,那么我必须按下来搜索该应用程序.它失败了试图从终端更快地到达我的应用程序的整个目的.
如果出现这种行为的原因,我可以知道为什么会这样,也可以解决这个问题吗?
我在debian jessie上,我正在尝试建立凤凰框架.我用mix phoenix.new创建了一个新的凤凰应用程序,然后输入该文件夹.当我运行'npm install'时,我收到以下错误:
sudo npm install
npm ERR! git clone git@github.com:file:deps/phoenix_html Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-file-deps-phoenix-html-50a27b71'...
npm ERR! git clone git@github.com:file:deps/phoenix_html Permission denied (publickey).
npm ERR! git clone git@github.com:file:deps/phoenix_html fatal: Could not read from remote repository.
npm ERR! git clone git@github.com:file:deps/phoenix_html
npm ERR! git clone git@github.com:file:deps/phoenix_html Please make sure you have the correct access rights
npm ERR! git clone git@github.com:file:deps/phoenix_html and the repository exists.
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'phoenix_html' is not in …Run Code Online (Sandbox Code Playgroud) 我知道我们应该使用命令“git mergetool”来解决冲突并使用“git difftool”来比较更改。但是我们如何在github windows中将SourceGear DiffMerge设置为github mergetool和difftool呢?
多部分表单数据文件上传抛出错误body should be object。我正在使用ajv插件,但仍然遇到同样的问题。下面是我的代码供参考。
应用程序.js
const fastify = require('fastify')({
logger: true
});
const Ajv = require('ajv');
const ajv = new Ajv({
useDefaults: true,
coerceTypes: true,
$data: true,
extendRefs: true
});
ajv.addKeyword("isFileType", {
compile: (schema, parent, it) => {
parent.type = "file";
delete parent.isFileType;
return () => true;
},
});
fastify.setSchemaCompiler((schema) => ajv.compile(schema));
Run Code Online (Sandbox Code Playgroud)
路线.js
schema: {
tags: [{
name: 'Category'
}],
description: 'Post category data',
consumes: ['multipart/form-data'],
body: {
type: 'object',
isFileType: true,
properties: {
name: { …Run Code Online (Sandbox Code Playgroud)