类型“ImportMeta”上不存在属性“env” 解决办法
新建一个env.d.ts文件,在里面写入
/// <reference types="vite/client" />在 tsconfig.json 文件中 include 包含进这个env.d.ts文件,并在types中增加 “vite/client”
{ "types": ["node", "vite/client", "element-plus/global"], "include": [ "**/*.d.ts" ] }
新建一个env.d.ts文件,在里面写入
/// <reference types="vite/client" />在 tsconfig.json 文件中 include 包含进这个env.d.ts文件,并在types中增加 “vite/client”
{
"types": ["node", "vite/client", "element-plus/global"],
"include": [
"**/*.d.ts"
]
}@ echo off
%1 %2
ver|find "5.">nul&&goto :Admin
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
:Admin
::下面是自己的代码
@ echo on
cd /d "%~dp0"
net start Npc
pause 
浏览器F12控制台设置中,把“JavaScript源映射”去掉可临时解决,如需永久解决需升级最新版本vite
参考:
https://github.com/vitejs/vite/issues/5916 (问题原因)
https://github.com/vitejs/vite/issues/9825 (参考Alternative中描述)
https://github.com/stascorp/rdpwrap
https://github.com/sebaxakerhtc/rdpwrap.ini/blob/master/rdpwrap.ini
组策略(gpedit.msc) -> 计算机配置 -> 管理模板 -> Windows 组件 -> 远程桌面服务 -> 远程桌面会话主机 -> 连接 -> 将远程桌面服务用户限制到单独的远程桌面服务会话(启用)
// 添加转发
netsh interface portproxy add v4tov4 listenport=445 listenaddress=127.0.0.1 connectport=8000 connectaddress=baidu.com
// 查看转发列表
netsh interface portproxy show all
// 删除转发
netsh interface portproxy delete v4tov4 listenport=445 listenaddress=127.0.0.1 protocol=tcp猜想:
\双反斜杠通过unc路径访问共享文件夹,猜测默认会追加445端口,因此ip地址不能手动去添加端口,只能通过系统自带代理转发功能转发至远程共享文件
import { loadEnv } from 'vite'
const root = process.cwd()
const env = loadEnv(process.argv[process.argv.length - 1], root)import { defineConfig } from 'vite'
// ...
export default defineConfig({
// ...
define: {
'process.env': {}// 将上面的env赋值到这里
}
})或者
import { createVuePlugin } from 'vite-plugin-vue2'
export default {
plugins: [
createVuePlugin(/* options */)
],
define: {
'process.env': {}// 将上面的env赋值到这里
},
resolve: {
alias: {
'views': '@/views'
}
},
server: {
host: '0.0.0.0'
}
}需要在最新的vite版本下才会生效,旧版本会导致build报错
console.log(import.meta.env.DEV);注:
grep可以替换为findstr(grep在linux下可用,findstr在windows下可用)adb shell可省略adb shell dumpsys activity settings | grep max_phantom_processes
adb shell device_config set_sync_disabled_for_tests persistent
adb shell device_config put activity_manager max_phantom_processes 65536
查看当前屏幕运行的appadb shell dumpsys window | grep Focus
adb shell ps -A | grep vmos
adb shell ps -A
.Net
appsettings.{环境名}.json
例如:appsettings.AliyunTest.json
IIS 部署运行下的 ,web.config 设置环境变量
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<aspNetCore processPath="dotnet" arguments=".\xxxxxxx.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="AliyunTest" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>控制台运行(适用于jenkins运行)
set ASPNETCORE_ENVIRONMENT=AliyunTest
dotnet run --no-launch-profile语法如下:
DELETE [dbo].[UC_Employee_his]
FROM [dbo].[UC_Employee_his] a
INNER JOIN
(
SELECT (GID + TeamCode + CAST(CheckOut AS NVARCHAR(50))) flag,-- 唯一标识:GID + 部门Code + CheckOut时间
ROW_NUMBER() OVER (PARTITION BY GID + TeamCode + CAST(CheckOut AS NVARCHAR(50))
ORDER BY GID + TeamCode + CAST(CheckOut AS NVARCHAR(50))
) rowNumber,
*
FROM [dbo].[UC_Employee_his]
) b ON a.Id = b.Id
WHERE b.rowNumber >= 2