windows系统中的node.js可以在服务器启动前设置环境,如下:
set NODE_ENV=production
Run Code Online (Sandbox Code Playgroud)
该NODE_ENV
参数可以使用 innode.js
或electron
by process.env.NODE_ENV
。
但是当我通过 构建电子时electron-builder
,就像这样:
electron-builder build --windows
Run Code Online (Sandbox Code Playgroud)
如何设置环境变量?
更新:
可能无法将固定的环境变量传递给可执行文件electron-builder
。
可能只能手动加载一个环境文件,打包时修改,或者把参数预置到dev
状态。当没有状态时,它是production
。
当我导入HttpClient
调用我自己编写的 node.js API 时,URL 的设置存在一些问题。
例如:
import { HttpClient, HttpHeaders } from '@angular/common/http';
export class myComponent implements OnInit {
constructor(
private http: HttpClient,
) {}
ngOnInit(): void {
this.http.get('http://127.0.0.1:3000/getData/theme').subscribe(data => {
});
});
}
//angular default port 4200,
//node.js default port 3000,
Run Code Online (Sandbox Code Playgroud)
当我设置this.http.get('/getData/theme')
了get
将呼叫http://127.0.0.1:4200
,这是错误的。如果我this.http.get('http://127.0.0.1:3000/getData/theme')
为本地开发设置它的工作原理。但是,当ng build
设置到实际服务器时,它无法正常连接。
控制台:
GET http://127.0.0.1:3000/getData/theme
net::ERR_CONNECTION_REFUSED
GET http://localhost:3000/structureData/themeData
net::ERR_CONNECTION_REFUSED
Run Code Online (Sandbox Code Playgroud)
如何设置正确的 URL 以使其同时满足在线和本地开发状态?
angular-cli 服务器 - 如何将 API 请求代理到另一台服务器?
我设置了 package.json:
"start": "ng serve --proxy-config proxy.conf.json"
Run Code Online (Sandbox Code Playgroud)
和 …
我通过 RXJS 的间隔时间改变参数做了一个轮播效果。
我发现它在开发模式(ng serve)下工作,但在该universal
模式下无法正常工作,无法进入页面。
例如:
n: number = 0;
max: number = 5;
constructor(){}
ngOnInit() {
this.carousel();
}
carousel() {
this.subscription = interval(2000).subscribe(() => {
//In universal, the console.log message show in node.js background log message not in browser console message. Each time the page is reorganized, it will be executed once and cannot be destroyed.
console.log(`show the photo: ${this.n}`);
if (this.n>this.max){
this.n = 0;
}else{
this.n = this.n+1;
}
}
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
Run Code Online (Sandbox Code Playgroud)
我在 …
如果我有 gitlab 帐户,\n用户名:account1\nemail:email1@outlook.con
\n\n终端中的初始设置:
\n\ngit config --global user.name account1\ngit config --global user.email email1@outlook.con\n
Run Code Online (Sandbox Code Playgroud)\n\n如果我有另一个 gitlab 帐户,\n用户名:account2\nemail:email2@outlook.con
\n\n当我更改用户信息时:
\n\ngit config --global user.name account2\ngit config --global user.email email2@outlook.con\n
Run Code Online (Sandbox Code Playgroud)\n\n我将文件推送到 gitlab ,“活动”信息仍然显示 account1。
\n\n我通过 https 路径通过 tortoisegit 推送文件。
\n\n我发现即使删除了gitlab中的SSH KEY,仍然可以通过https路径推送文件。
\n\n我需要重置?\n我该怎么办?
\n\n\xef\xbc\x8a我删除了git并重新安装,发现用户信息仍然存在...
\n我angular cli
从6版本升级到8.1,Angular universal
已经改变了简单的构建方法@nguniversal/module-map-ngfactory-loader
,我应该重新部署,清除旧配置。
ng add @nguniversal/express-engine --clientProject [project name]
错误信息:
Skipping installation: Package already installed
Target name already exists.
Run Code Online (Sandbox Code Playgroud)
跑 npm install --save @nguniversal/module-map-ngfactory-loader
构建通用,运行build:ssr
(“npm run build:client-and-server-bundles && npm run compile:server”)
我需要删除一些文件,修改一些文件并重新安装@nguniversal/express-engine
?
TightVNC 提供了此文件用于嵌入网页(Java Viewer
):
https://www.tightvnc.com/download/2.8.3/tvnjviewer-2.8.3-bin-gnugpl.zip
viewer-applet-example.html
在文件中,提供了一个示例:
加载<applet>
jar( tightvnc-jviewer.jar
),对象(com.glavsoft.viewer.Viewer
)
设置<param>
ip( localhost
),port( 5900
)...
<html>
<head>
<title>TightVNC desktop</title>
</head>
<body>
<applet archive="tightvnc-jviewer.jar"
code="com.glavsoft.viewer.Viewer"
width="100" height="100">
<param name="Host" value="localhost"/>
<!-- Host to connect. Default: the host from which the applet was loaded. -->
<param name="Port" value="5900"/>
<!-- Port number to connect. Default: 5900 -->
<!--param name="Password" value="" /--> <!-- Password to the server (not recommended to use this parameter here) -->
<param name="OpenNewWindow" …
Run Code Online (Sandbox Code Playgroud) Angular@HostListener
可以检测鼠标移动。但我希望能够识别我滑动的元素的间隔。
例如:
成分:
@HostListener('window:scroll', ['$event'])
onScroll(event) {
console.log(event);
//When the mouse is scrolled, identify which element is currently displayed on the browser window, A or B or C
//element A,B,C height is not fixed
}
Run Code Online (Sandbox Code Playgroud)
css:
#a,#b,#c {
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
html:
<body>
<div id="a" (scroll)="onScroll($event)">
Block A
.
.
(more element)
</div>
<div id="b" (scroll)="onScroll($event)">
Block B
.
.
(more element)
</div>
<div id="c" (scroll)="onScroll($event)">
Block C
.
.
(more element)
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
我试图查看event
参数,但它是一个相当大的对象,我找不到不同元素之间的区别: