gpt4 book ai didi

angular - 类型错误 : Cannot read property 'directoryExists' of undefined

转载 作者:行者123 更新时间:2023-12-02 16:09:38 25 4
gpt4 key购买 nike

通过 将我的 Angular 2 CLI 项目从 1.0.0-beta.11-webpack.2 更新到 1.0.0-beta.11-webpack.8 >ng init,并且运行 ngserve 会导致以下错误:

** NG Live Development Server is running on http://localhost:4200. **
10% building modules 4/7 modules 3 active ...ode_modules/style-loader/addStyles.jsTypeError: Cannot read property 'directoryExists' of undefined
at Object.getAutomaticTypeDirectiveNames (/home/jan/src/fm-repos/fm-ui/node_modules/typescript/lib/typescript.js:43865:17)
at State.loadTypesFromConfig (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:150:36)
at new State (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:144:14)
at Object.ensureInstance (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/instance.ts:150:19)
at compiler (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:37:20)
at Object.loader (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:18:18)
at LOADER_EXECUTION (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:95:14)
at runSyncOrAsync (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:96:4)
at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:200:2)
at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:189:10)
at /home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:204:3
at Object.context.callback (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:87:13)
at Object.module.exports (/home/jan/src/fm-repos/fm-ui/node_modules/angular2-template-loader/index.js:32:10)
at LOADER_EXECUTION (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:95:14)
at runSyncOrAsync (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:96:4)
at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:200:2)
at /home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:173:4
at Storage.finished (/home/jan/src/fm-repos/fm-ui/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:39:16)
at /home/jan/src/fm-repos/fm-ui/node_modules/enhanced-resolve/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) 'TypeError: Cannot read property \'directoryExists\' of undefined\n at Object.getAutomaticTypeDirectiveNames (/home/jan/src/fm-repos/fm-ui/node_modules/typescript/lib/typescript.js:43865:17)\n at State.loadTypesFromConfig (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:150:36)\n at new State (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:144:14)\n at Object.ensureInstance (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/instance.ts:150:19)\n at compiler (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:37:20)\n at Object.loader (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:18:18)\n at LOADER_EXECUTION (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:95:14)\n at runSyncOrAsync (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:96:4)\n at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:200:2)\n at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:189:10)\n at /home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:204:3\n at Object.context.callback (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:87:13)\n at Object.module.exports (/home/jan/src/fm-repos/fm-ui/node_modules/angular2-template-loader/index.js:32:10)\n at LOADER_EXECUTION (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:95:14)\n at runSyncOrAsync (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:96:4)\n at iterateNormalLoaders (/home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:200:2)\n at /home/jan/src/fm-repos/fm-ui/node_modules/loader-runner/lib/LoaderRunner.js:173:4\n at Storage.finished (/home/jan/src/fm-repos/fm-ui/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:39:16)\n at /home/jan/src/fm-repos/fm-ui/node_modules/enhanced-resolve/node_modules/graceful-fs/graceful-fs.js:78:16\n at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)'
1753ms building modules
2ms sealing
0ms optimizing
0ms basic module optimization
2ms module optimization
0ms advanced module optimization
4ms basic chunk optimization
0ms chunk optimization
0ms advanced chunk optimization
0ms module and chunk tree optimization
10ms module reviving
0ms module order optimization
1ms module id optimization
1ms chunk reviving
0ms chunk order optimization
3ms chunk id optimization
3ms hashing
0ms module assets processing
19ms chunk assets processing
1ms additional chunk assets processing
0ms recording
0ms additional asset processing
192ms chunk asset optimization
40ms asset optimization
15ms emitting
Hash: 865ed065ce2165dac568
Version: webpack 2.1.0-beta.21
Time: 2067ms
Asset Size Chunks Chunk Names
main.bundle.js 241 kB 0, 2 [emitted] main
styles.bundle.js 10.2 kB 1, 2 [emitted] styles
inline.js 5.53 kB 2 [emitted] inline
main.map 295 kB 0, 2 [emitted] main
styles.map 14 kB 1, 2 [emitted] styles
inline.map 5.59 kB 2 [emitted] inline
index.html 616 bytes [emitted]
assets/.npmignore 0 bytes [emitted]

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'directoryExists' of undefined
at Object.getAutomaticTypeDirectiveNames (/home/jan/src/fm-repos/fm-ui/node_modules/typescript/lib/typescript.js:43865:17)
at State.loadTypesFromConfig (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:150:36)
at new State (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/host.ts:144:14)
at Object.ensureInstance (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/instance.ts:150:19)
at compiler (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:37:20)
at Object.loader (/home/jan/src/fm-repos/fm-ui/node_modules/awesome-typescript-loader/src/index.ts:18:18)
@ multi main
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 2.96 kB 0
webpack: bundle is now VALID.

最佳答案

临时修复。只有一件事对我有用,并且运行到我的库中 cd projects/{library}/tsconfig.lib.json: "annotateForClosureCompiler": true将其从 true 更改为 false。我认为这可能是 ngc 的一个问题。我找到了相关的https://github.com/angular/angular/pull/26738也许吧。

来源 https://www.gitmemory.com/issue/angular/tsickle/1046/516028024

关于angular - 类型错误 : Cannot read property 'directoryExists' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39495846/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com