You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular项目添加Scully失败:无配置文件及目录生成求助

解决Scully初始化失败及配置文件缺失问题

1. 手动指定项目名称重新执行初始化

执行ng add @scullyio/init时,若Scully自动识别项目名称失败,可手动指定项目名重试:

ng add @scullyio/init --project=你的项目名称

注:项目名称可在angular.json文件的"name"字段中找到。

2. 手动补全缺失的文件与目录

如果重新执行命令仍无效果,直接手动创建以下内容:

根目录创建Scully配置文件

新建scully.你的项目名称.config.ts文件,填入基础模板内容:

import { ScullyConfig } from '@scullyio/scully';

export const config: ScullyConfig = {
  projectRoot: "./src",
  projectName: "你的项目名称",
  outDir: './dist/static',
  routes: {
  }
};

创建scully目录结构

  • 在项目根目录新建scully文件夹,内部创建tsconfig.json:
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2017",
    "lib": ["es2017"],
    "types": ["node"]
  },
  "include": ["**/*.ts"]
}
  • 在scully文件夹内再创建plugins子文件夹,内部新建plugin.ts文件(可先留空,后续按需添加插件代码)。

3. 检查环境与版本兼容性

  • 确认Angular版本与Scully版本兼容:Scully对Angular版本有明确要求,比如Angular 12+需搭配对应版本的Scully稳定版,可查看package.json中的依赖版本,不兼容则升级或降级对应包。
  • 执行命令时确保终端处于Angular项目根目录,路径错误会导致文件生成失败。

4. 修复配置文件路径错误

若仍出现scully.undefined.config.ts找不到的报错,手动修改package.json中的Scully脚本:
找到scripts字段下的scully命令,将--config scully.undefined.config.ts替换为--config scully.你的项目名称.config.ts,示例:

"scripts": {
  "scully": "scully --config scully.你的项目名称.config.ts",
  "scully:serve": "scully serve"
}

内容的提问来源于stack exchange,提问作者Tatyana Molchanova

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 11:45:57