Javascript 我最近格式化了我的硬盘,但我的项目在另一个驱动器中。但是我得到了这个节点错误?

Javascript 我最近格式化了我的硬盘,但我的项目在另一个驱动器中。但是我得到了这个节点错误?,javascript,node.js,Javascript,Node.js,我最近格式化了我的硬盘,但我的项目在另一个驱动器中。但是我得到了这个节点错误 G:\co\NodeJs\project\node_modules\require_optional\node_modules\resolve-from\index.js:1SyntaxError: Invalid or unexpected token at wrapSafe (internal/modules/cjs/loader.js:1053:16) at Module._compile (internal/m

我最近格式化了我的硬盘,但我的项目在另一个驱动器中。但是我得到了这个节点错误

G:\co\NodeJs\project\node_modules\require_optional\node_modules\resolve-from\index.js:1SyntaxError: Invalid or unexpected token
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> 

(G:\co\NodeJs\project\node_modules\require_optional\index.js:4:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
[nodemon] app crashed - waiting for file changes before starting...
因此,显然,您的G:\co\NodeJs\project\node\u modules\require\u optional\node\u modules\resolve from\index.js文件为空,但它应该具有


因此,某些设备安装不正确。您应该重新安装所有从属模块,或者手动修复此特定模块。我建议首先卸载然后重新安装此模块。如果在其他地方出现错误,则可能从NPM中删除所有相关模块并重新安装所有模块。

我建议重新安装“从模块解析”和/或“需要可选”模块,因为它们看起来像是错误源。@jfriend00我试过了,但仍然显示相同的错误,G:\co\NodeJs\project\node\u modules\require\u optional\node\u modules\resolve from\index.js的第1行是什么?这显然是node.js不喜欢的。还有,nodejs的哪个版本?@jfriend00该文件是空的,而节点版本是v12.18.3。那么,该文件不应该是空的。它应该是什么。有些东西安装不正确。您应该更新或重新安装所有相关模块,或手动修复此特定模块。