在 Ubuntu 中安装 npm 包时出错 [重复]

2023-12-26

我有一个项目,以前工作正常,突然开始显示此错误:- 这是一个使用create-react-app创建的react项目。 同样的错误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 [email protected] /cdn-cgi/l/email-protection: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated [email protected] /cdn-cgi/l/email-protection: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected] /cdn-cgi/l/email-protection: Please update: there are crash fixes
npm WARN deprecated [email protected] /cdn-cgi/l/email-protection: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected] /cdn-cgi/l/email-protection: 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

感谢您的帮助


首先,您应该更新您的软件包:

apt-get update
apt-get -y upgrade

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

E.g:

rm -rf node_modules
rm package-lock.json

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

npm i

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Ubuntu 中安装 npm 包时出错 [重复] 的相关文章

随机推荐