运行纱线启动时为什么会出现语法错误

问题描述 投票:-1回答:1

当我尝试运行yarn start时,我在命令行中看到一个错误,指出存在语法错误。

我尝试过更新节点和纱线。

$ node --max_old_space_size=8192 ./node_modules/.bin/ng serve -H 0.0.0.0 --disable-host-check
C:\Users\OMARSaid\cui-shell-ui-develop\node_modules\.bin\ng:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')");
          ^^^^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```

I expect for it to run properly since there was no modification done.
angular yarnpkg
1个回答
0
投票

使用来自nodejs的路径模块而不是直接称为'dirname'

const path = require('path');
path.resolve(__dirname);

并检查您的代码,它显示语法错误。请更正它,希望它能运作。

© www.soinside.com 2019 - 2024. All rights reserved.