NodeJS 升级Angular 后无法启动故事书

8gsdolmq  于 2023-01-12  发布在  Node.js
关注(0)|答案(1)|浏览(139)

在我将Angular 从12升级到14后,我在启动故事书应用程序时遇到了问题。运行时出现了一些问题:

WARN   Failed to load preset: "C:\\Users\\a.shakirov\\project\\src\\front\\project-ui-kit\\node_modules\\@storybook\\angular\\dist\\ts3.9\\server\\framework-preset-angular-ivy.js"
ERR! Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\a.shakirov\project\src\front\project-ui-kit\node_modules\@angular\compiler-cli\bundles\ngcc\index.js
ERR! require() of ES modules is not supported.
ERR! require() of C:\Users\a.shakirov\project\src\front\project-ui-kit\node_modules\@angular\compiler-cli\bundles\ngcc\index.js from C:\Users\a.shakirov\project\src\front\project-ui-kit\node_modules\@storybook\angula
r\dist\ts3.9\server\framework-preset-angular-ivy.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
ERR! Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\a.shakirov\project\src\front\project-ui-kit\node_modules\@angular\compiler-cli\package.json.

以及

ERR! => Could not get angular cli webpack config
ERR! Error: Missing required options in project target. Check "tsConfig, assets, 
optimization"
ERR!     at C:\Users\a.shakirov\project\src\front\project-ui-kit\node_modules\@storybook\angular\dist\ts3.9\server\angular-devkit-build-webpack.js:133:27

我不知道怎么修理它们
故事书版本为6.3.12
节点版本为14.17.6
Angular 版本为14

qacovj5a

qacovj5a1#

似乎只有故事书版本7.0.0-alpha.0才支持Angular14,所以您可能希望在项目中使用测试版本,直到实际的7+版本发布为止

npm i --save-dev @storybook/angular@7.0.0-alpha.34

相关问题