首页 > 解决方案 > npm 错误!代码 ERR_INVALID_ARG_TYPE npm install 时出错

问题描述

我将我的项目克隆到 ubuntu 服务器中进行部署,但是当我尝试安装依赖项时,我遇到了最大调用堆栈大小超出错误。然后按照stackoverflow上的答案我删除了节点模块和package.json。但是现在当我执行 npm install 时,我遇到了以下错误。

npm ERR! code ERR_INVALID_ARG_TYPE
npm ERR! errno ERR_INVALID_ARG_TYPE
npm ERR! request to https://registry.npmjs.org/@material-ui%2fcore failed, reason: The "msecs" argument must be of type number. Received type string ('600001')

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ute/.npm/_logs/2021-07-20T08_00_38_282Z-debug.log 

当我执行 npm update -g 时也会出现相同类型的错误

npm ERR! request to https://registry.npmjs.org/npm failed,
reason: The "msecs" argument must be of type number. Received type string ('600001')

标签: npmreact-scripts

解决方案


您不应该删除 package.json 文件,因为该文件包含依赖项的必要详细信息作为模块和其他数据。

您可以npm init在您的特定目录中创建一个 package.json 文件,然后使用此命令安装您的模块npm i -S [your_dependency]


推荐阅读