【发布时间】:2018-08-29 04:20:07
【问题描述】:
我正在使用iot-dsa JS sdk angular4 和nodejs 开发一个webApp。我的app.component.js 看起来像:
import { Component } from '@angular/core';
import { LinkProvider } from 'dslink';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
link = new LinkProvider(['http://127.0.0.1:8080/conn'],
'RequesterExample-', {
isRequester: true,
isResponder: false
});
res = this.link.connect().then(function() {
return this.link.onRequesterReady;
}).then(function(requester) {
// work with requester here
});
}
使用ng build 构建代码时出现此错误:
ERROR in node_modules/dslink/dist/dslink.node.d.ts(2,23): error TS2552: Cannot find name 'NodeJS'. Did you mean 'Node'?
如果需要更多信息,请告诉我。
【问题讨论】:
-
如果你关注the source file where the error happens中的cmets,使用的版本是Node v6。您使用的是什么版本的 Node?span>
-
@PaulRey 正在使用节点 v6.12.3
-
假设您在 Angular(客户端)中使用它 - 您不应该使用浏览器版本的 dslink (/dist/dslink.browser.js) 吗?
-
@lwallent 我应该如何以及在哪里指定这个?
-
@humblebee 这取决于您的构建/部署基础架构。您或许应该用更多细节更新您的问题。
标签: node.js angular typescript