phpinfo 的 Node 中等同于检查配置设置的是什么?
答案 0 :(得分:1)
Here is a link到提供相同类型信息的软件包(nodejs-info)。
如果要查看存在哪些环境变量,也可以console.log
像这样:console.log(process.env);
答案 1 :(得分:0)
它与phpinfo()
不是完全等效的,但是您通常会向phpinfo提出的任何问题都可以由process
全局变量来回答。 Rastalamm的答案触及了这一点,但不仅仅是process.env
。
类似于phpinfo,console.log(process)
会告诉您您正在运行的节点的版本,加载的内部/本地模块(不同于NPM模块)以及process.config
下的各种配置设置。 / p>
这是一个示例,来自我的AWS Cloud9实例在模拟Lambda环境时:
2020-04-22 22:32:22.590 process {
version: 'v12.16.1',
versions: {
node: '12.16.1',
v8: '7.8.279.23-node.31',
uv: '1.34.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '72',
nghttp2: '1.40.0',
napi: '5',
llhttp: '2.0.4',
http_parser: '2.9.3',
openssl: '1.1.1d',
cldr: '36.0',
icu: '65.1',
tz: '2019c',
unicode: '12.1'
},
arch: 'x64',
platform: 'linux',
release: {
name: 'node',
lts: 'Erbium',
sourceUrl: 'https://nodejs.org/download/release/v12.16.1/node-v12.16.1.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz'
},
_rawDebug: [Function: _rawDebug],
moduleLoadList: [
'Internal Binding native_module',
'Internal Binding errors',
'Internal Binding buffer',
'NativeModule internal/errors',
'Internal Binding config',
'Internal Binding constants',
'Internal Binding util',
'Internal Binding types',
'NativeModule internal/util',
'NativeModule internal/util/types',
'NativeModule internal/assert',
'NativeModule internal/util/inspect',
'NativeModule events',
'Internal Binding string_decoder',
'NativeModule internal/validators',
'NativeModule internal/buffer',
'Internal Binding icu',
'NativeModule buffer',
'NativeModule internal/process/per_thread',
'Internal Binding process_methods',
'Internal Binding credentials',
'Internal Binding async_wrap',
'Internal Binding task_queue',
'NativeModule internal/async_hooks',
'NativeModule internal/process/promises',
'NativeModule internal/fixed_queue',
'NativeModule internal/process/task_queues',
'Internal Binding trace_events',
'NativeModule internal/console/constructor',
'NativeModule internal/console/global',
'NativeModule internal/util/inspector',
'Internal Binding inspector',
'NativeModule internal/querystring',
'NativeModule internal/constants',
'NativeModule path',
'Internal Binding url',
'NativeModule internal/url',
'NativeModule internal/encoding',
'Internal Binding timers',
'NativeModule internal/linkedlist',
'NativeModule internal/priority_queue',
'NativeModule internal/util/debuglog',
'NativeModule internal/timers',
'NativeModule timers',
'NativeModule internal/process/execution',
'NativeModule internal/process/warning',
'NativeModule internal/process/signal',
'Internal Binding options',
'NativeModule internal/options',
'NativeModule internal/bootstrap/pre_execution',
'NativeModule internal/inspector_async_hook',
'Internal Binding fs',
'NativeModule internal/fs/utils',
'Internal Binding fs_dir',
'NativeModule internal/fs/dir',
'NativeModule fs',
'NativeModule internal/idna',
'NativeModule url',
'NativeModule internal/modules/cjs/helpers',
'NativeModule internal/source_map/source_map_cache',
'Internal Binding contextify',
'NativeModule vm',
'NativeModule internal/modules/cjs/loader',
'NativeModule internal/modules/run_main',
'Internal Binding module_wrap',
'NativeModule util',
'NativeModule internal/assert/assertion_error',
'NativeModule assert',
'NativeModule internal/streams/pipeline',
'NativeModule internal/streams/end-of-stream',
'NativeModule internal/streams/legacy',
'NativeModule internal/streams/buffer_list',
'NativeModule internal/streams/destroy',
'NativeModule internal/streams/state',
'NativeModule _stream_readable',
'NativeModule _stream_writable',
'NativeModule _stream_duplex',
'NativeModule _stream_transform',
'NativeModule _stream_passthrough',
'NativeModule stream',
'NativeModule internal/net',
'Internal Binding uv',
'Internal Binding stream_wrap',
'Internal Binding tcp_wrap',
'Internal Binding pipe_wrap',
'NativeModule internal/stream_base_commons',
'NativeModule internal/dtrace',
'NativeModule net',
'NativeModule _http_agent',
'Internal Binding http_parser_llhttp',
'NativeModule internal/freelist',
'NativeModule _http_incoming',
'NativeModule _http_common',
'Internal Binding performance',
'NativeModule internal/http',
'NativeModule _http_outgoing',
'NativeModule _http_client',
'NativeModule _http_server',
'NativeModule http'
],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_events: [Object: null prototype] {
newListener: [Function: startListeningIfSignal],
removeListener: [Function: stopListeningIfSignal],
warning: [Function: onWarning],
uncaughtException: [Function],
unhandledRejection: [Function],
beforeExit: [Function: invoke]
},
_eventsCount: 6,
_maxListeners: undefined,
domain: null,
_exiting: false,
config: {
target_defaults: {
cflags: [],
default_configuration: 'Release',
defines: [],
include_dirs: [],
libraries: []
},
variables: {
asan: 0,
build_v8_with_gn: false,
coverage: false,
debug_nghttp2: false,
enable_lto: false,
enable_pgo_generate: false,
enable_pgo_use: false,
force_dynamic_crt: 0,
gas_version: '2.29',
host_arch: 'x64',
icu_data_in: '../../deps/icu/source/data/in/icudt65l.dat',
icu_endianness: 'l',
icu_gyp_path: 'tools/icu/icu-generic.gyp',
icu_path: 'deps/icu',
icu_small: false,
icu_ver_major: '65',
is_debug: 0,
llvm_version: '0.0',
napi_build_version: '5',
node_byteorder: 'little',
node_debug_lib: false,
node_enable_d8: false,
node_install_npm: true,
node_module_version: 72,
node_no_browser_globals: false,
node_prefix: '/var/lang',
node_release_urlbase: '',
node_report: true,
node_shared: false,
node_shared_cares: false,
node_shared_http_parser: false,
node_shared_libuv: false,
node_shared_nghttp2: false,
node_shared_openssl: false,
node_shared_zlib: false,
node_tag: '',
node_target_type: 'executable',
node_use_bundled_v8: true,
node_use_dtrace: false,
node_use_etw: false,
node_use_large_pages: false,
node_use_large_pages_script_lld: false,
node_use_node_code_cache: true,
node_use_node_snapshot: true,
node_use_openssl: true,
node_use_v8_platform: true,
node_with_ltcg: false,
node_without_node_options: false,
openssl_fips: '',
openssl_is_fips: false,
shlib_suffix: 'so.72',
target_arch: 'x64',
v8_enable_gdbjit: 0,
v8_enable_i18n_support: 1,
v8_enable_inspector: 1,
v8_no_strict_aliasing: 1,
v8_optimized_debug: 1,
v8_promise_internal_field_count: 1,
v8_random_seed: 0,
v8_trace_maps: 0,
v8_use_siphash: 1,
v8_use_snapshot: 1,
want_separate_host_toolset: 0
}
},
dlopen: [Function: dlopen],
uptime: [Function: uptime],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
reallyExit: [Function: reallyExit],
_kill: [Function: _kill],
hrtime: [Function: hrtime] { bigint: [Function: hrtimeBigInt] },
cpuUsage: [Function: cpuUsage],
resourceUsage: [Function: resourceUsage],
memoryUsage: [Function: memoryUsage],
kill: [Function: kill],
exit: [Function: exit],
openStdin: [Function],
getuid: [Function: getuid],
geteuid: [Function: geteuid],
getgid: [Function: getgid],
getegid: [Function: getegid],
getgroups: [Function: getgroups],
allowedNodeEnvironmentFlags: [Getter/Setter],
assert: [Function: deprecated],
features: {
inspector: true,
debug: false,
uv: true,
ipv6: true,
tls_alpn: true,
tls_sni: true,
tls_ocsp: true,
tls: true,
cached_builtins: true
},
_fatalException: [Function],
setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
emitWarning: [Function: emitWarning],
nextTick: [Function: nextTick],
_tickCallback: [Function: runNextTicks],
_debugProcess: [Function: _debugProcess],
_debugEnd: [Function: _debugEnd],
_startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
_stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
stdout: [Getter],
stdin: [Getter],
stderr: [Getter],
abort: [Function: abort],
umask: [Function: wrappedUmask],
chdir: [Function: wrappedChdir],
cwd: [Function: wrappedCwd],
initgroups: [Function: initgroups],
setgroups: [Function: setgroups],
setegid: [Function],
seteuid: [Function],
setgid: [Function],
setuid: [Function],
env: {
AWS_LAMBDA_FUNCTION_VERSION: '$LATEST',
HOSTNAME: '164a55144521',
_LAMBDA_CONTROL_SOCKET: '14',
AWS_SAM_LOCAL: 'true',
AWS_SESSION_TOKEN: 'IQoJb3JpZ2luX2VjECYaCXVzLWVhc3QtMSJHMEUCIE0b15xzUs/7OJwC7KgnlcbQBDKw2Yk1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
LAMBDA_TASK_ROOT: '/var/task',
LD_LIBRARY_PATH: '/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib',
AWS_LAMBDA_RUNTIME_API: '127.0.0.1:9001',
AWS_LAMBDA_LOG_STREAM_NAME: '2020/04/22/[$LATEST]8ac4142c629e7e08931e5a0eaff80123',
_LAMBDA_SHARED_MEM_FD: '11',
AWS_EXECUTION_ENV: 'AWS_Lambda_nodejs12.x',
_LAMBDA_RUNTIME_LOAD_TIME: '1530232235231',
AWS_LAMBDA_FUNCTION_NAME: 'test',
AWS_XRAY_DAEMON_ADDRESS: '169.254.79.2:2000',
PATH: '/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin',
_LAMBDA_LOG_FD: '9',
AWS_DEFAULT_REGION: 'us-east-1',
PWD: '/var/task',
AWS_SECRET_ACCESS_KEY: 'YNF6WsPQ2sXHi3CNi5a3TDuL2LnGZZdGLHv6x7J1',
LAMBDA_RUNTIME_DIR: '/var/runtime',
LANG: 'en_US.UTF-8',
NODE_PATH: '/opt/nodejs/node12/node_modules:/opt/nodejs/node_modules:/var/runtime/node_modules:/var/runtime:/var/task',
TZ: ':UTC',
AWS_REGION: 'us-east-1',
AWS_LAMBDA_FUNCTION_HANDLER: 'RunSync/index.handler',
AWS_ACCESS_KEY_ID: 'ASIA4WQEVF3YKL2RO2HZ',
SHLVL: '0',
HOME: '/home/sbx_user1051',
_AWS_XRAY_DAEMON_ADDRESS: '169.254.79.2',
_AWS_XRAY_DAEMON_PORT: '2000',
_X_AMZN_TRACE_ID: 'Root=1-dc99d00f-c079a84d433534434534ef0d;Parent=91ed514f1e5c03b2;Sampled=1',
_LAMBDA_SB_ID: '7',
AWS_XRAY_CONTEXT_MISSING: 'LOG_ERROR',
_LAMBDA_CONSOLE_SOCKET: '16',
_HANDLER: 'RunSync/index.handler',
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: '256',
AWS_LAMBDA_EVENT_BODY: '{}'
},
title: '/var/lang/bin/node',
argv: [ '/var/lang/bin/node', '/var/runtime/index.js' ],
execArgv: [
'--expose-gc',
'--max-http-header-size',
'81920',
'--max-semi-space-size=12',
'--max-old-space-size=231'
],
pid: 12,
ppid: 1,
execPath: '/var/lang/bin/node',
debugPort: 9229,
argv0: '/var/lang/bin/node',
_preload_modules: [],
mainModule: Module {
id: '.',
path: '/var/runtime',
exports: {},
parent: null,
filename: '/var/runtime/index.js',
loaded: true,
children: [ [Module], [Module], [Module], [Module], [Module], [Module] ],
paths: [
'/var/runtime/node_modules',
'/var/node_modules',
'/node_modules'
]
},
[Symbol(kCapture)]: false
}