我最近将我们的项目升级为yarn berry。仍然使用node_modules和nodeLinker:node-modules。
\n运行“yarn”命令时,我看到以下错误:
\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Link step\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 core-js@npm:2.6.12 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 @getgauge/cli@npm:1.4.3 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 protobufjs@npm:6.11.3 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 core-js@npm:3.18.3 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 husky@npm:3.1.0 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 node-sass@npm:7.0.1 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 taiko@npm:1.2.7 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 taiko@npm:1.3.1 must be built because it never has been before or the last one failed\n\xe2\x9e\xa4 YN0007: \xe2\x94\x82 core-js-pure@npm:3.18.3 must be built because it never has been before or the last one failed\nRun Code Online (Sandbox Code Playgroud)\n我不确定为什么纱线要求构建这些包。之前我们从未在node_modules 中构建过包。我怎样才能解决这个问题?
\n在我的项目中,当遇到此错误时,在Link step上面问题引用之前,我也遇到了许多must be built because it never has been before or the last one failed错误,其中有许多警告Resolution step,例如:
\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Resolution step\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 vendor-frontend@workspace:. doesn't provide @babel/core (pa3ad5), requested by @babel/plugin-proposal-class-properties\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 vendor-frontend@workspace:. doesn't provide @babel/core (p4b1ed), requested by @babel/plugin-proposal-decorators\n\xe2\x9e\xa4 YN0002: \xe2\x94\x82 (... about a dozen more ...)\n\xe2\x9e\xa4 YN0000: \xe2\x94\x82 Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed in 0s 239ms\nRun Code Online (Sandbox Code Playgroud)\n正如 Yarn 在最后一条消息中建议的那样,我运行了:
\nyarn explain peer-requirements pxxxxx\nRun Code Online (Sandbox Code Playgroud)\n在我的例子中,pxxxxx实际上是pa3ad5第一个“”警告中的代码doesn't provide。
对我来说,这产生了:
\n\xe2\x9e\xa4 YN0000: vendor-frontend@workspace:. doesn't provide @babel/core, breaking the following requirements:\n\xe2\x9e\xa4 YN0000: @babel/helper-create-class-features-plugin@npm:7.20.7 [967d5] \xe2\x86\x92 ^7.0.0 \xe2\x9c\x98\n\xe2\x9e\xa4 YN0000: @babel/plugin-proposal-class-properties@npm:7.18.6 [8c8ef] \xe2\x86\x92 ^7.0.0-0 \xe2\x9c\x98\n\xe2\x9e\xa4 YN0000: Note: these requirements start with @babel/plugin-proposal-class-properties@npm:7.18.6 [8c8ef]\nRun Code Online (Sandbox Code Playgroud)\n“npm”,是吗?这促使我运行:
\nnpm install\nRun Code Online (Sandbox Code Playgroud)\n至此成功完成:
\nadded 23 packages, removed 32 packages, changed 18 packages, and audited 1351 packages in 15s\nRun Code Online (Sandbox Code Playgroud)\n但我的应用程序(在本地开发环境中运行)仍然显示编译错误。
\n所以我尝试回到原来的命令,再次运行:
\nyarn install\nRun Code Online (Sandbox Code Playgroud)\n这成功完成,并让我的本地应用程序再次启动并运行。
\n| 归档时间: |
|
| 查看次数: |
10192 次 |
| 最近记录: |