[英]Update npm installed packages - npm ERR! code EINVALIDPACKAGENAME
I'm trying to update my node modules globally.我正在尝试全局更新我的节点模块。 I'm using this command我正在使用这个命令
sudo npm update -g
but it will produce thise error in terminal但它会在终端产生这个错误
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name ".DS_Store": name cannot start with a period
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dev/.npm/_logs/2021-04-24T15_59_25_014Z-debug.log
I think that the command will scan the folder and find macOS .DS_Store
file.我认为该命令将扫描文件夹并找到 macOS .DS_Store
文件。
How I can fix this?我该如何解决这个问题?
I solved the same issue for Mac OS Monterey using this我使用这个解决了 Mac OS Monterey 的相同问题
find `npm list -g | head -1` -name '.DS_Store' -type f -delete
for me doing this solve my problem:对我来说这样做解决了我的问题:
find /usr/local/lib/node_modules/ -name '.DS_Store' -type f -delete
It search all.DS_Store and remove it in the global node_modules folder ( on Mac )它搜索 all.DS_Store 并将其删除到全局 node_modules 文件夹中(在 Mac 上)
You can try this one,你可以试试这个
sudo npm install --global npm
I think this is going to work for you我认为这对你有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.