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) 
相关推荐
万敏11 小时前
Vue3 全栈实战第五周:Vitest 单元测试从零搭建实战记录
vue.js·node.js·全栈
星栈19 小时前
我以为 TS7.0 只是换个版本号,结果编译快了 9 倍,也踩了 5 个坑
后端·typescript·node.js
Synmbrf20 小时前
Mosquitto 持久化消息积压导致网关内存耗尽的排查
node.js
AINative软件工程21 小时前
LLM Streaming 背压工程实践:慢客户端、断流重连与服务端缓冲区的生产设计
node.js·llm
码林鼠1 天前
webpack的基本配置
前端·webpack·node.js
FeelTouch Labs2 天前
Node.js 中的 spawn 和 exec:子进程执行的不同方式对比
node.js·编辑器·vue·vim
烂蜻蜓2 天前
Node.js入门教程(一):初识Node.js——服务端JavaScript的诞生与特点
开发语言·javascript·node.js
凌云拓界2 天前
NodeVerdict:Node.js 原生诊断数据可视化工具
信息可视化·架构·typescript·开源·node.js·github·bug
用户2930750976692 天前
React Router v6 实战:理解 SPA 路由系统
node.js