我正在尝试在运行 e2e 时对我的项目进行测试(通过“ng e2e”或从我的 PhpStorm 测试工具运行量角器代码)。
我在“ng e2e”中遇到的错误是
DevTools listening on ws://127.0.0.1:60945/devtools/browser/79a66426-83f8-4059-888c-4e6a27bd09b5
[06:22:32] E/launcher - Error: Error: Cannot find module './env'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\www\blankblankproject\e2e\src\app.e2e-spec.ts:3:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Module.m._compile (C:\www\blankblankproject\node_modules\ts-node\src\index.ts:400:23)
at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Object.require.extensions.(anonymous function) [as .ts] (C:\www\blankblankproject\node_modules\ts-node\src\index.ts:403:12)
at Module.load (internal/modules/cjs/loader.js:600:32)
[06:22:32] E/launcher - Process exited with error code 100
An unexpected error occurred: undefined
如果我在 PhpStorm 中运行它
"C:\Program Files\nodejs\node.exe" C:\www\blankblankproject\node_modules\protractor\bin\protractor "C:\Program Files\JetBrains\PhpStorm 2019.1\plugins\JavaScriptLanguage\helpers\protractor-intellij\lib\protractor-intellij-config.js" --intellijOriginalConfigFile=C:\www\blankblankproject\e2e\protractor.conf.js --disableChecks
[06:39:27] I/launcher - Running 1 instances of WebDriver
[06:39:27] I/direct - Using ChromeDriver directly...
[06:39:31] E/launcher - Error: Error: Cannot find module './env'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\www\blankblankproject\e2e\src\app.e2e-spec.ts:3:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Module.m._compile (C:\www\blankblankproject\node_modules\ts-node\src\index.ts:400:23)
at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Object.require.extensions.(anonymous function) [as .ts] (C:\www\blankblankproject\node_modules\ts-node\src\index.ts:403:12)
at Module.load (internal/modules/cjs/loader.js:600:32)
[06:39:31] E/launcher - Process exited with error code 100
Process finished with exit code 4
感谢您的任何帮助