分配失败 - 处理内存不足

时间:2017-08-28 13:23:49

标签: node.js angular webpack webpack-dev-server webpack-2

我要编译web-pack我有问题,即分配失败 - 处理内存不足。我知道我可以使用这个增加空间大小

  

- max_old_space_size = 8192

我尝试了很多方法来解决这个问题,但没有任何方法可行。 这是我的package.json

"scripts": {
    "karma": "karma",
    "test": "karma start",
    "rimraf": "rimraf",
    "tslint": "tslint",
    "typedoc": "typedoc",
    "webpack": "webpack --progress --profile --bail",
    "webpack-dev-server": "webpack-dev-server",
    "webdriver-manager": "webdriver-manager",
    "clean": "npm cache clean && npm run rimraf -- node_modules doc coverage dist compiled dll",
    "clean:dist": "npm run rimraf -- dist",
    "clean:dll": "npm run rimraf -- dll",
    "clean:electron": "npm run rimraf -- build",
    "preclean:install": "npm run clean",
    "clean:install": "npm set progress=false && npm install",
    "preclean:start": "npm run clean",
    "clean:start": "npm start",
    "watch": "npm run watch:dev",
    "watch:dev": "npm run build:dev -- --watch",
    "watch:dev:hmr": "npm run watch:dev -- --hot",
    "watch:prod": "npm run build:prod -- --watch",
    "build": "npm run build:dev",
    "prebuild:dev": "npm run clean:dist",
    "build:dev": " npm run clean:dist && npm run webpack -- --config config/webpack.dev.js",
    "prebuild:prod": "npm run clean:dist",
    "build:prod": "npm run clean:dist && webpack --config config/webpack.prod.js  --progress --profile",
    "server": "npm run server:dev",
    "server:dev": "webpack-dev-server --config config/webpack.dev.js --progress --profile --watch --content-base src/",
    "server:dev:hmr": "npm run server:dev -- --inline --hot",
    "server:prod": "http-server dist -c-1 --cors",
    "server:test": "http-server dist-demo -c-1 --cors",
    "server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
    "webdriver:update": "npm run webdriver-manager update",
    "webdriver:start": "npm run webdriver-manager start",
    "lint": "npm run tslint \"src/**/*.ts\" --force",
    "ngc": "./node_modules/.bin/ngc-w -p tsconfig.webpack.json",
    "pree2e": "npm run webdriver:update -- --standalone",
    "pretest": "npm run lint",
    "docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
    "gh-pages": "wintersmith build -C docs && gh-pages -d docs/build",
    "start": "npm run server:dev",
    "start:hmr": "npm run server:dev:hmr",
    "version": "npm run build",
    "postversion": "git push && git push --tags",
    "build:electron": "npm run build:electron.full",
    "prebuild:electron.full": "npm run clean:electron",
    "build:electron.full": "npm run build:electron.renderer && npm run build:electron.main",
    "postbuild:electron.full": "npm run electron:start",
    "build:electron.renderer": "npm run webpack -- --config config/electron/webpack.renderer.prod.js",
    "build:electron.main": "npm run webpack -- --config config/electron/webpack.electron.prod.js",
    "electron:start": "electron build",
    "build:aot:prod": "npm run clean:dist && npm run clean:aot && webpack --config config/webpack.prod.js  --progress --profile --bail",
    "build:aot": "npm run build:aot:prod",
    "clean:aot": "npm run rimraf -- compiled",
    "build:ci": "npm run build:prod && npm run build:aot"
  },

和运行我的package.json的命令是

  

npm服务器

请帮助我增加尺寸。

1 个答案:

答案 0 :(得分:0)

我有类似的问题。我使用的是节点版本8.x.将其降级为6.11.0解决了我的问题。