dea*_*904 9 javascript node.js
我正在使用 Node.js 10.0.0 & 我的index.mjs样子:
import path from "path";
console.log(__dirname);
Run Code Online (Sandbox Code Playgroud)
在我的终端中,我运行
node --experimental-modules index.mjs
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
(node:3750) ExperimentalWarning: The ESM module loader is experimental.
ReferenceError: __dirname is not defined
at file:///MyFolderPath/node-10/index.mjs:3:21
at ModuleJob.run (internal/modules/esm/module_job.js:106:14)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6327 次 |
| 最近记录: |