endel / increase-memory-limit

Increase memory limit for local node binaries ("max-old-space-size")
http://npmjs.com/package/increase-memory-limit
MIT License
267 stars 26 forks source link

SyntaxError: Unexpected identifier #21

Open fuchangge opened 5 years ago

fuchangge commented 5 years ago

vue-cli项目 平台:mac node:10.14.2

"scripts": {
    "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
    "serve": "vue-cli-service serve",
  }
$ npm run serve

> scfsweb@1.0.0 serve /Users/hfd/Documents/ms/gitlab/sc/fsweb/dev/
> vue-cli-service serve

/Users/hfd/Documents/ms/gitlab/sc/fsweb/dev/node_modules/@vue/cli-service/bin/vue-cli-service.js:5
const requiredVersion = require('../package.json').engines.node --max-old-space-size=4096
                                                                  ^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:83:7)
    at createScript (vm.js:267:10)
    at Object.runInThisContext (vm.js:319:10)
    at Module._compile (internal/modules/cjs/loader.js:686:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
    at executeUserCode (internal/bootstrap/node.js:342:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scfsweb@1.0.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scfsweb@1.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hfd/.npm/_logs/2018-12-26T01_39_05_364Z-debug.log
fuchangge commented 5 years ago

最后找到这个文件删除掉了--max-old-space-size=4096

zljs commented 5 years ago

找到increase-memory-limit下的index.js ,更改if (line.startsWith("if [") || line.startsWith("@IF"))
if (line.startsWith("if [") || line.startsWith("@IF") || line.startsWith('const requiredVersion ='))

YuFengDing commented 5 years ago

最后找到这个文件删除掉了--max-old-space-size=4096

亲测ok thanks

YuFengDing commented 5 years ago

找到increase-memory-limit下的index.js ,更改if (line.startsWith("if [") || line.startsWith("@IF"))if (line.startsWith("if [") || line.startsWith("@IF") || line.startsWith('const requiredVersion ='))

macos 10.14没用

Axent96 commented 4 years ago

I have the same problem

zrp1025 commented 2 years ago

rm -rf node_modules npm i