increase-memory-limit icon indicating copy to clipboard operation
increase-memory-limit copied to clipboard

SyntaxError: Unexpected identifier

Open fuchangge opened this issue 5 years ago • 6 comments

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

> [email protected] 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! [email protected] serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 avatar Dec 26 '18 01:12 fuchangge

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

fuchangge avatar Dec 26 '18 01:12 fuchangge

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

zljs avatar Feb 19 '19 09:02 zljs

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

亲测ok thanks

YuFengDing avatar Apr 07 '19 15:04 YuFengDing

找到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没用

YuFengDing avatar Apr 07 '19 15:04 YuFengDing

I have the same problem

Axent96 avatar Jun 05 '20 13:06 Axent96

rm -rf node_modules npm i

zrp1025 avatar Apr 25 '22 07:04 zrp1025