我最近将我的
angular projects
从angular 16
更新为ngular 17
。 npm install
与我的笔记本电脑上的 angular 17
完美配合。但在 Azure 管道上,它会抛出错误:-
"FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory".
我该如何解决这个问题?
在一个存储库中,我通过将
"npm install"
作为脚本更改为 "npm install"
作为内置任务来解决此问题:Npm@1
。
但它在另一个仓库中不起作用。我还在
package-lock.json
之前删除了npm install
,但没有帮助。
您需要在
nodejs
中使用以下脚本来增加 yaml code
的内存分配:-
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- script: |
NODE_OPTIONS="--max-old-space-size=4096" npm install
displayName: 'npm install with increased memory'
- script: |
npm cache clean --force
displayName: 'Clear npm cache'
- script: |
npm install --only=dev
displayName: 'Install dev dependencies'
输出:-
参考我的SO答案