节点更新后 npm 重建错误

节点更新后 npm 重建错误

自从我上次在 v12 中更新节点后,我无法使用 npm 重建选项。

我尝试清除并重新安装节点但失败了,我最终手动删除了 node_modules(如果您想查看我删除的内容,可以查看此链接上上传的 .txt 上的注释行:https://filebin.net/twbmbrrd23z4s0z4

我重新安装了 node v10.12.0(像以前一样)和 npm v6.4.1,但即使这样,我仍然出现以下错误:

root@xxxx-VirtualBox:/home/xxxx/Desktop/opencti# npm rebuild

> [email protected] postinstall /home/xxxx/Desktop/opencti/node_modules/core-js
> node scripts/postinstall || echo "ignore"

internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module '/home/xxxx/Desktop/opencti/node_modules/core-js/scripts/postinstall'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
ignore

> [email protected] postinstall /home/xxxx/Desktop/opencti/node_modules/apollo-engine-reporting-protobuf/node_modules/protobufjs
> node scripts/postinstall

internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module '/home/xxxx/Desktop/opencti/node_modules/apollo-engine-reporting-protobuf/node_modules/protobufjs/scripts/postinstall'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall 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!     /root/.npm/_logs/2019-09-15T06_03_57_920Z-debug.log

如果您知道我还能做什么,我会很高兴,谢谢。

答案1

显然,我只需要清理 npm 的缓存并在我的工作目录中使用 nmp install 命令;现在它可以正常工作了。

相关内容