Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected identifier #21

Open
lisiming789 opened this issue Dec 26, 2018 · 6 comments
Open

SyntaxError: Unexpected identifier #21

lisiming789 opened this issue Dec 26, 2018 · 6 comments

Comments

@lisiming789
Copy link

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
@lisiming789
Copy link
Author

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

@zljs
Copy link

zljs commented Feb 19, 2019

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

@YuFengDing
Copy link

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

亲测ok thanks

@YuFengDing
Copy link

找到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
Copy link

Axent96 commented Jun 5, 2020

I have the same problem

@zrp1025
Copy link

zrp1025 commented Apr 25, 2022

rm -rf node_modules
npm i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants