NPM 安装总是失败,在 .staging 文件夹中找不到 JSON 解析和文件

Posted

技术标签:

【中文标题】NPM 安装总是失败,在 .staging 文件夹中找不到 JSON 解析和文件【英文标题】:NPM install always fails with JSON parse & file not found in .staging folder 【发布时间】:2021-08-03 14:17:41 【问题描述】:

Npm install 对我来说失败了

    json 解析异常(每次在不同位置) .staging 警告中找不到文件

我在节点上:12.18.3,npm:6.14.6 对于我的其他队友来说,它工作正常

我试过了

节点和 npm 重新安装

用 nvm 也试过

npm 缓存清理 –force

已删除节点模块

已删除包锁定 json

还增加了缓冲区的大小

http.postbuffer=524288000

http.maxrequestbuffer=100M

日志

IN-GN-52242:ui amar.tangade$ npm install

Sophos-Cloud-UI@1.0.0 预安装 /Users/amar.tangade/Desktop/cloud/ui 节点任务/check-install.js

x----------------------------------------警告------ - - - - - - - - - - - - - - - - -X Cloud ui 应在“/Users/amar.tangade/g/cloud/ui”处签出 X - - - - - - - - - - - - - - - - - - - - - - - - - ------------------------------------x

npm WARN tar ENOENT:没有这样的文件或目录,打开 '/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@angular/animations-d4575e16/bundles/animations.umd.min.js ' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@amcharts/amcharts4-geodata-28cad3f5/chinaLow.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/bootstrap-d6314d99/dist/js/bootstrap.min.js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@amcharts/amcharts4-geodata-28cad3f5/chinaLow.js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@sentry/tracing-103892ec/build/bundle.tracing.min.js.map' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/fontkit-a9ca368f/src/opentype/shapers/data.trie' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/fontkit-a9ca368f/src/opentype/shapers/indic.trie' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/fontkit-a9ca368f/src/opentype/shapers/use.trie' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@angular/upgrade-74767da7/esm2015/static/src/downgrade_module.js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/svg-to-pdfkit-a3211ec1/examples/demo.htm' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@angular/animations-d4575e16/fesm2015/browser.js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@angular/cdk-8525faf0/bundles/cdk-overlay.umd.min.js' npm WARN tar ENOENT:没有这样的文件或目录,lstat '/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/pdfmake-0c446f39/src/browser-extensions' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/pdfmake-0c446f39/build/pdfmake.min.js' npm 错误!在 '...ecterm**](http://elec' 附近解析时 JSON 输入意外结束 npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@ng-bootstrap/ng-bootstrap-802705fe/esm2015/modal/modal-dismiss-原因.js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@ng-bootstrap/ng-bootstrap-802705fe/esm2015/modal/modal-ref。 js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/@ng-bootstrap/ng-bootstrap-802705fe/esm2015/modal/modal-stack。 js' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/CONTRIBUTING.md' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/DEVELOPER.md' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/exampleTypescript/asyncAwait/README.md' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/exampleTypescript/README.md' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/README.md' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/exampleTypescript/angularPage.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/driverProviders/attachSession.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/bpRunner.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/browser.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/driverProviders/browserStack.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/cli.d.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/exampleTypescript/conf.ts' npm WARN tar ENOENT:没有这样的文件或目录,打开'/Users/amar.tangade/Desktop/cloud/ui/node_modules/.staging/protractor-646a0f46/built/config.d.ts'

【问题讨论】:

可以加栈错误吗? 【参考方案1】:

我将 npm 版本降级到 6.14.5,它对我有用。

【讨论】:

以上是关于NPM 安装总是失败,在 .staging 文件夹中找不到 JSON 解析和文件的主要内容,如果未能解决你的问题,请参考以下文章

转:npm install 时总是报phantomjs-prebuilt@2.1.14安装失败

npm安装全局的 -g 依赖失败 没权限问题

npm,bower安装失败

卸载 vue 2.9.6 失败

Firebase功能npm安装总是卡住

NPM 安装在 docker 容器中失败 - npm WARN tar ENOENT:没有这样的文件或目录