npm install 报错

1、protobufjs@7.4.0 postinstall: node scripts/postinstall verbose stack Error: protobufjs@7.4.0 postinstall: node scripts/postinstall

bash 复制代码
确认是否有postinstall

# node scripts/postinstall

Cannot find module '/home/rio/scripts/postinstall'

解决办法:

bash 复制代码
# 添加忽略参数
npm install @vue/cli -g --ignore-scripts
npm install protobufjs -g --ignore-scripts
npm install --save @opentelemetry/auto-instrumentations-node -g --ignore-scripts

2、ENOENT: no such file or directory, open '/usr/local/package.json'

解决方法:

不能使用在root用户目录部署

到普通用户目录下,执行 npm init ,全默认即可,再执行npm install就正常了

bash 复制代码
[root@rio-accessgate rio]# npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (rio) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /home/rio/package.json:

{
  "name": "rio",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes) 
相关推荐
yuanlaile14 小时前
从入门到部署|2026年Koa全栈开发实战:覆盖Node.js、数据库、部署与云架构全链路
微服务·云原生·kubernetes·node.js·serverless·nodejs全栈开发
onebyte8bits15 小时前
NestJS 系列教程(十八):文件上传与对象存储架构(Multer + S3/OSS + 访问控制)
前端·架构·node.js·状态模式·nestjs
苏瞳儿15 小时前
前端/后端-配置跨域
前端·javascript·node.js·vue
SP八岐大兔16 小时前
NPM管理OpenClaw安装、卸载及运维命令
运维·前端·npm·openclaw
陈佬昔没带相机1 天前
GitHub clone 不动、pip 卡住、brew 转圈?一份指南搞定
git·npm
码云之上1 天前
上下文工程实战:解决多轮对话中的"上下文腐烂"问题
前端·node.js·agent
奔跑的呱呱牛2 天前
前端/Node.js操作Excel实战:使用@giszhc/xlsx(导入+导出全流程)
前端·node.js·excel·xlsx·sheetjs
Southern Wind2 天前
AI Skill Server 动态技能中台
前端·后端·mysql·node.js
米丘2 天前
Vite 代理跨域全解析:从 server.proxy 到请求转发的实现原理
javascript·node.js·vite