为什么我会在一段时间后继续得到这个Node SyntaxError?

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

任何人都可以帮我解决这个SyntaxError吗?我不断在不同的路径上获取它,不仅是猫鼬,有时候蓝鸟有时是另一个模块。

尝试并删除了node_modules文件夹并重新安装了修复问题的npm模块,但在运行几次脚本后,它又出现了。

老实说,在重新安装node_modules之后,我无法解释它为什么会起作用,经过几次运行后,它就不再存在了。

节点:v9.8.0 NPM:5.7.1

node_modules/mongoose/lib/options.js:1
(function (exports, require, module, __filename, __dirname) {


SyntaxError: Invalid or unexpected token
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
node.js npm node-modules
1个回答
0
投票

您有SyntaxError,因为您的npm安装中有一些损坏的文件可能是由于您的互联网波动或任何其他原因。删除node_modules文件夹并重新安装npm模块后,你仍然会遇到同样的错误,因为我说的是同样的事情。

所以你的问题上次修复了,因为你重新安装了所有必需的依赖项后,你的node_modules中已经完全安装了。

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