在 Ubuntu 中安装 npm 包时出错 [英] Error on insatling npm packages in Ubuntu

查看:334
本文介绍了在 Ubuntu 中安装 npm 包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,以前它工作正常突然开始显示此错误:-这是一个使用 create-react-app 创建的 React 项目.npm installnpm -f install

I am having a project, previously it was working fine suddenly it started showing this error :- This is a react project created using create-react-app. Same Error for npm install and npm -f install

sudipt@sudo:~/Desktop/project/console-frontend$ npm -f install
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated fsevents@2.0.6: Please update: there are crash fixes
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! Linux 5.3.0-46-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "-f" "install"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/sudipt/Desktop/hydra-python-agent-gui/console-frontend/npm-debug.log

感谢您的帮助

推荐答案

首先,你应该更新你的包:

First of all, you should update your packages:

apt-get update
apt-get -y upgrade

然后在您的项目目录中,删除之前安装的 node_modules 和 package-lock:

Then on your project directory, remove the previously installed node_modules and package-lock:

例如:

rm -rf node_modules
rm package-lock.json

然后再次安装更新的软件包:

And then install the updated packages again:

npm i

鉴于上下文,这是我的建议,我希望这会有所帮助!

Given the context this is what I would suggest, I hope this helps!

这篇关于在 Ubuntu 中安装 npm 包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆