抛出新的TypeError('I-node_modules / semver / semver.js:296

时间:2019-02-04 17:33:14

标签: node.js npm yarnpkg

昨天,这个错误开始于两个项目,哪种解决方案可行?

node_modules/yo

Output:
/Users/mac/.config/yarn/global/node_modules/semver/semver.js:296
    throw new TypeError('I
                    ^^

SyntaxError: Invalid or unexpected token
    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)

1 个答案:

答案 0 :(得分:0)

问题是下载了缓存的semver,然后在项目文件夹中执行命令yarn cache clean并解决了。

谢谢