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) 
相关推荐
abigale039 天前
webpack+vite前端构建工具 - 8 代码分割
前端·webpack·node.js
abigale039 天前
webpack+vite前端构建工具 - 9 webpack技巧性配置
前端·webpack·node.js
jghhh019 天前
深入浅出Node.js后端开发
node.js
ZJ_.9 天前
Electron自动更新详解—包教会版
linux·前端·javascript·windows·electron·前端框架·node.js
HsuYang9 天前
我是这样使用AI提高前端基础建设工具效率的
前端·架构·node.js
泓博10 天前
Node鼠标键盘屏幕控制
node.js
red润10 天前
Node.js 常用安全模块大全汇总
前端·javascript·node.js
listhi52010 天前
深入浅出Node.js中间件机制
中间件·node.js
yinke小琪10 天前
node
前端·node.js
盛夏绽放10 天前
Node.js 中的 JWT 认证:从生成到验证的完整指南
后端·node.js·有问必答