小编Akh*_*mar的帖子

我在for循环中使用let关键字给出了SyntaxError:意外的标识符

我在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)

node.js ecmascript-6

6
推荐指数
1
解决办法
5476
查看次数

未找到兼容版本:安装angular2 RC4路由器时出现@ angular/router @ ^ 2.0.0-rc.4错误

我有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)

routing npm angular2-routing angular2-router angular

6
推荐指数
1
解决办法
2565
查看次数

postgres 不知道在哪里可以找到服务器配置文件

我已经安装了 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)

postgresql

6
推荐指数
1
解决办法
1万
查看次数

将字符串拆分为字典单词和非字典单词

我想用字典将字符串拆分成一系列单词.

以下函数只给我带字母边界的单词.

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卢比

可以在此处找到示例字典以供参考.

javascript regex string algorithm

5
推荐指数
1
解决办法
1094
查看次数

Ionic给出提示:获取开发者许可证,安装签名证书

我正在使用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)

windows node.js ionic2

5
推荐指数
1
解决办法
416
查看次数

数组缩减功能返回NAN

我有类似的代码如下:

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)

javascript reduce

5
推荐指数
2
解决办法
3891
查看次数

TypeError:self.parent.parent.context.parseInt不是函数

我正在尝试使用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)

javascript angular

5
推荐指数
1
解决办法
1100
查看次数

找不到模块:错误:无法解析“@angular/core”

我正在尝试在完成所有安装后运行存储库 angular2-webpack-starter。当我运行命令npm startwebpack它抛出以下错误:

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)

typescript webpack angular

5
推荐指数
1
解决办法
2万
查看次数

compiler.getLogger 不是一个函数

copy-webpack-plugin从升级4.6.06.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 在此处输入图片说明 不知道是什么问题

copy webpack webpack-dev-server copy-webpack-plugin

4
推荐指数
1
解决办法
4207
查看次数

fs.writeFile没有返回pdf文件,因为它的内容是

我正在使用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)

jquery content-type fs node.js mime-types

3
推荐指数
1
解决办法
1390
查看次数