我在for循环中使用let关键字如下
for(let methd1 in servUrl){
let methd=methd1;
for(let pth1 in servUrl[methd]) {
let pth=pth1;
app[methd](pth, servUrl[methd][pth]);
}
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误
for(let methd1 in servUrl){
^^^^^^
SyntaxError: Unexpected identifier
Run Code Online (Sandbox Code Playgroud) 我有package.json依赖项如下:
"dependencies": {
"@angular/common": "^2.0.0-rc.4",
"@angular/compiler": "^2.0.0-rc.4",
"@angular/core": "^2.0.0-rc.4",
"@angular/http": "^2.0.0-rc.4",
"@angular/platform-browser": "^2.0.0-rc.4",
"@angular/platform-browser-dynamic": "^2.0.0-rc.4",
"@angular/platform-server": "^2.0.0-rc.4",
"@angular/router": "^2.0.0-rc.4",
"angular2-jwt": "0.1.15",
"es6-promise": "^3.2.1",
"es6-shim": "^0.35.0",
"jwt-decode": "^2.0.1",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.6",
"zone.js": "^0.6.12"
}
Run Code Online (Sandbox Code Playgroud)
但是在安装npm时会出现以下错误:
G:\rc4>npm i
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" npm ERR! node v6.0.0 npm ERR! npm v3.8.6
npm ERR! No compatible version found: @angular/router@^2.0.0-rc.4
npm ERR! Valid install targets:
npm ERR! 3.0.0-beta.2, 3.0.0-beta.1, 3.0.0-alpha.8, 3.0.0-alpha.7, 3.0.0-alpha.6, 3.0.0-alpha.5, 3.0.0-alpha.4, 3.0.0-alpha.3, 3.0.0-alpha.2, …Run Code Online (Sandbox Code Playgroud) 我已经安装了 PostgreSQL,但是当我postgres在 Windows CMD 中运行命令时
它给出以下错误:
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud)
即使在运行命令之后
initdb postgres维持类似的问题postgres -D C:\Program Files\PostgreSQL\data\
给了我以下输出:postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud) 我想用字典将字符串拆分成一系列单词.
以下函数只给我带字母边界的单词.
function spltToWord(prm){
var spltedAr = prm.split(/(?=[A-Z][a-z])/);
return spltedAr.join(" ").trim();
}
Run Code Online (Sandbox Code Playgroud)
我想将文本分成字典/非字典单词.
例如:
Iamno123prisoner - 我不是123囚犯
USAisveryrich - 美国非常富裕
Albertgaveme5rupees - Albert给了我5卢比
可以在此处找到示例字典以供参考.
我正在使用Ionic构建一个Windows应用程序,但在运行命令离子运行窗口后,我得到了以下日志:
Before installing this app, you need to do the following:
- Acquire a developer license
- Install the signing certificate
Administrator credentials are required to continue. Please accept the UAC prompt and provide your administrator password if asked.
Press Enter to continue...:
Run Code Online (Sandbox Code Playgroud)
然后停止后,在控制台中没有听到按键事件.
当我使用管理员权限运行cmd时.它给出以下错误:
Error: Can not run this platform with administrative permissions. Must be run from a non-admin prompt.
Run Code Online (Sandbox Code Playgroud) 我有类似的代码如下:
var temp=[{"name":"Agency","y":32,"drilldown":{"name":"Agency","categories":["APPS & SI","ERS"],"data":[24,8]}},{"name":"ER","y":60,"drilldown":{"name":"ER","categories":["APPS & SI","ERS"],"data":[7,53]}},{"name":"Direct","y":60,"drilldown":{"name":"Direct","categories":["APPS & SI","ERS"],"data":[31,29]}}];
var reduced=temp.reduce(function (a,b) {
return a.y + b.y;
});
console.log(reduced) // returns NAN
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ngStyle为img指定高度,为此我用一些数学运算来计算高度,如下所示:
<div [ngSwitch]="tbNm?tbNm:'itm0'">
<ion-list *ngFor="let vl of scrnshot;let ind=index">
<img *ngSwitchCase="'itm'+ind" alt="Akhilesh" [ngStyle]="{'height':(parseInt(vl.names[0].hitWid.bdHt+(websitTyp(vl._id.origin)?100:0)))+'px','width':(vl.names[0].hitWid.bdWd+'px')}" [src]="vl.names[0].base64">
</ion-list>
</div>
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时会出现以下错误:
error_handler.js:51 TypeError: self.parent.parent.context.parseInt is not a function
at DebugAppView._View_HomePage9.detectChangesInternal (HomePage.ngfactory.js:1444)
at DebugAppView.AppView.detectChanges (view.js:272)
at DebugAppView.detectChanges (view.js:377)
at DebugAppView.AppView.detectContentChildrenChanges (view.js:290)
at DebugAppView._View_HomePage8.detectChangesInternal (HomePage.ngfactory.js:1407)
at DebugAppView.AppView.detectChanges (view.js:272)
at DebugAppView.detectChanges (view.js:377)
at DebugAppView.AppView.detectContentChildrenChanges (view.js:290)
at DebugAppView._View_HomePage0.detectChangesInternal (HomePage.ngfactory.js:270)
at DebugAppView.AppView.detectChanges (view.js:272)
Run Code Online (Sandbox Code Playgroud) 我正在尝试在完成所有安装后运行存储库
angular2-webpack-starter。当我运行命令npm start或webpack它抛出以下错误:
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/core' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
@ ./src/vendor.browser.ts 10:0-24
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/common' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
@ ./src/vendor.browser.ts 11:0-26
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/forms' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
@ ./src/vendor.browser.ts 12:0-25
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/http' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src'
@ ./src/vendor.browser.ts 13:0-24
ERROR in ./src/vendor.browser.ts
Module not found: Error: Can't resolve '@angular/router' in 'E:\mya4p\gtLbA4p\angular2-webpack-starter\src' …Run Code Online (Sandbox Code Playgroud) 我copy-webpack-plugin从升级4.6.0到6.0.2
我改变了我的代码
plugins: [
new CopyWebpackPlugin([{
from: clientAssetPath,
to: paths.STATICS,
ignore: [ '.gitkeep' ],
}], {
debug: 'info'
}),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
Run Code Online (Sandbox Code Playgroud)
到
plugins: [
new CopyPlugin([{
patterns: [{
from: clientAssetPath,
to: paths.STATICS,
noErrorOnMissing: true
}]
}]),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
Run Code Online (Sandbox Code Playgroud)
但它开始抛出以下错误:
compilation.getLogger is not a function
当我调试它时,我发现错误来自 node_modules/copy-webpack-plugin/dist/index.js
不知道是什么问题
我正在使用ajax从某个链接(基本上是锚点href)获取一些文件,然后我将内容发送到节点服务器,如下所示:
<a class="myTag" href="/getFiledata?uid=7674&&pass=75876789">Download</a>
Run Code Online (Sandbox Code Playgroud)
.
jQuery.get(jQuery("a.myTag").attr("href"), function(data, status){
console.log("typeof data: ",typeof data);
jQuery.ajax({
url : 'https://7c099919.ngrok.io/fildta?fileTyp=naukriDta',
type : 'POST',
contentType: 'application/json',
dataType: 'json',
data : JSON.stringify({bdy:data}),
arrayKey:'',
processData: false, // tell jQuery not to process the data
success : function(data) {
console.log(data);
}
});
console.log("Data: ",data );
});
Run Code Online (Sandbox Code Playgroud)
我在服务器上列出和写入数据如下:
function(req, res, next){
var fd=path.join(__dirname,"../upld/tmp.pdf");
console.log("req body: ",JSON.stringify(req.body));
fs.writeFile(fd, req.body.bdy, function(err) {
if (err){
console.log(fd,"\n\n\n\n\n Can not write to above file:\n\n",err);
}else {
console.log(fd,' is Done');
}
});
console.log("req query: ",req.query); …Run Code Online (Sandbox Code Playgroud) angular ×3
javascript ×3
node.js ×3
webpack ×2
algorithm ×1
content-type ×1
copy ×1
ecmascript-6 ×1
fs ×1
ionic2 ×1
jquery ×1
mime-types ×1
npm ×1
postgresql ×1
reduce ×1
regex ×1
routing ×1
string ×1
typescript ×1
windows ×1