我想使用node 20.9.0和yarn 3.2.4。
如果我这样做:
- mkdir测试
1.⑶测试
1.Yarn初始化 - yarn add protobufjs
我得到以下错误:
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 0s 813ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ @protobufjs/utf8@npm:1.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/node@npm:20.9.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ long@npm:5.2.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ protobufjs@npm:7.2.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ undici-types@npm:5.26.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ protobufjs@npm:7.2.5 must be built because it never has been before or the last one failed
➤ YN0009: │ protobufjs@npm:7.2.5 couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/7r/z2yvzrzx7_lg2h81285rsplr0000gp/T/xfs-6234630b/build.log)
➤ YN0000: └ Completed in 0s 474ms
➤ YN0000: Failed with errors in 1s 441ms
字符串
build.log文件正在报告.
# This file contains the result of Yarn building a package (protobufjs@npm:7.2.5)
# Script name: postinstall
node:internal/process/esm_loader:40
internalBinding('errors').triggerUncaughtException(
^
TypeError [Error]: [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "XXXX/.yarn/unplugged/protobufjs-npm-7.2.5-3439c554a5/node_modules/protobufjs/package.json" needs an import assertion of type "json"
at load$1 (file:///XXXX/.pnp.loader.mjs:1455:17)
at nextLoad (node:internal/modules/esm/hooks:833:28)
at Hooks.load (node:internal/modules/esm/hooks:416:26)
at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
Node.js v20.9.0
型
这是已知的问题吗?有解决方案吗?
1条答案
按热度按时间krcsximq1#
答案是这个bug是在yarn 3.2.4本身,而不是Cesium或Protobufjs。阻止构建的问题显然在yarn 3.6.3中得到了解决。这些步骤将在Node 20和Yarn >= 3.6.3中成功。