Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

执行 npx ets 时报错:SyntaxError: Cannot use import statement outside a module #106

Open
BiosSun opened this issue Mar 9, 2023 · 0 comments

Comments

@BiosSun
Copy link

BiosSun commented Mar 9, 2023

打印如下内容:

❯ npx ets
[egg-ts-helper] WARN loader.loadPlugin() error: /Users/myself/Develops/mock/config/plugin.ts:1
import path from 'path';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Module.m._compile (/Users/myself/Develops/mock/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/myself/Develops/mock/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at loadFile (/Users/myself/Develops/mock/node_modules/egg-core/lib/utils/index.js:27:19), cwd: /Users/myself/Develops/mock, framework: egg
[egg-ts-helper] create typings/app/controller/index.d.ts (3ms)
[egg-ts-helper] create typings/app/middleware/index.d.ts (2ms)
[egg-ts-helper] create typings/config/index.d.ts (23ms)
[egg-ts-helper] create typings/app/service/index.d.ts (2ms)
[egg-ts-helper] create typings/app/index.d.ts (1ms)

我的系统环境是:

  • macOS 13.0
  • node.js 14.21.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant