[英]TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.family' must be one of: 0, 4, 6. Received false
[英]TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '' error
當我嘗試構建反應應用程序時,它會顯示此錯誤
節點:內部/錯誤:465 ErrorCaptureStackTrace(錯誤); ^
TypeError [ERR_INVALID_ARG_VALUE]:參數“id”必須是非空字符串。 在新的 NodeError (node:internal/errors:372:5) at Module.require (node:internal/modules/cjs/loader:1000:11) at require (node:internal/modules/cjs/helpers:102 :18) 在 getConfigAsObject (C:\Users\syam.das\Desktop\5\doe-web\node_modules@craco\craco\lib\config.js:46:20) 在 loadCracoConfigAsync (C:\Users\syam.das \Desktop\5\doe-web\node_modules@craco\craco\lib\config.js:69:34)在 Object。 (C:\Users\syam.das\Desktop\5\doe-web\node_modules@craco\craco\scripts\start.js:22:1) 在 Module._compile (node:internal/modules/cjs/loader:1105 :14) 在 Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) 在 Module.load (node:internal/modules/cjs/loader:981:32) 在 Z86408593C34AF77FDD16Z0DF932F8B52 ._load (node:internal/modules/cjs/loader:822:12) { code: 'ERR_INVALID_ARG_VALUE' } error 命令失敗,退出代碼為 1. info 訪問 https://yarnpkg.com/en/docs/cli/run for有關此命令的文檔。
const path = require("path");
const fs = require("fs");
const { getArgs } = require("./args");
const { log } = require("./logger");
const { isString } = require("./utils");
const projectRoot = fs.realpathSync(process.cwd());
const packageJsonPath = path.join(projectRoot, "package.json");
log("Project root path resolved to: ", projectRoot);
let configFilePath = "";
const configFilenames = ["craco.config.js", ".cracorc.js", ".cracorc"];
const args = getArgs();
if (args.config.isProvided) {
configFilePath = path.resolve(projectRoot, args.config.value);
} else {
const package = require(packageJsonPath);
if (package.cracoConfig) {
if (!isString(package.cracoConfig)) {
throw new Error("craco: 'cracoConfig' value must be a string.");
}
configFilePath = path.resolve(projectRoot, package.cracoConfig);
} else {
for (const filename of configFilenames) {
const filePath = path.join(projectRoot, filename);
if (fs.existsSync(filePath)) {
configFilePath = filePath;
break;
}
}
}
}
log("Config file path resolved to: ", configFilePath);
module.exports = {
projectRoot,
packageJsonPath,
configFilePath
};
我只是在控制台中輸入yarn add @craco/craco
,現在它工作正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.