【问题标题】:Angular 9 ngcc try to scan entire diskAngular 9 ngcc 尝试扫描整个磁盘
【发布时间】:2020-05-25 10:52:04
【问题描述】:

我按照 angular.io 指南将 Angular 8 迁移到 Angular 9,但是在生成 ivy 入口点时遇到了问题。

当我执行npm install 时,我在ngcc 命令执行期间看到以下错误。

ngcc

Error: EPERM: operation not permitted, lstat 'E:/System Volume Information'
    at Object.lstatSync (fs.js:917:3)

我使用的是 Windows 10 和 Node 12,但我在 macOS 上尝试过,我得到了相同的结果(当然是在另一个系统保护路径上)。

按照我的安装后脚本

"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"

我搜索了这个问题并提出了解决方案,告诉我更改文件夹权限,但我不想让我的操作系统不安全。

如果没有 ngcc 工作,我也不能做 ng serve。

如何防止 ngcc 扫描整个磁盘并且只做它应该做的事情?是否有任何已知的错误?

编辑:

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2018", "dom"],
    "paths": {
      "@app/*": ["src/app/*"],
      "@src/*": ["src/*"],
      "@root/*": ["/*"]
    }
  }
}

【问题讨论】:

  • 您能显示您的tsconfig.json tsconfig.app.jsonangular.json 文件吗?那里的设置路径可能有问题
  • 非常感谢,问题出在 tsconfig.json

标签: angular npm-install angular-ivy


【解决方案1】:

问题出在 tsconfig.js 中

{
    ...
    "paths": {
      "@app/*": ["src/app/*"],
      "@src/*": ["src/*"],
      "@root/*": ["/*"]
    }
    ...
}

我希望@root 路径只针对项目的根目录,但我忘记了使它相对的点

"@root/*": ["./*"]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-26
    • 2011-01-11
    • 2014-09-19
    • 2011-04-14
    • 2013-03-31
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    相关资源
    最近更新 更多