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) 
相关推荐
Sapphire~19 小时前
odoo-087 安装 npm (node ok npm not)
linux·运维·npm
Benny的老巢19 小时前
【n8n工作流入门02】macOS安装n8n保姆级教程:Homebrew与npm两种方式详解
macos·npm·node.js·n8n·n8n工作流·homwbrew·n8n安装
2301_8187320621 小时前
下载nvm后,通过nvm无法下载node,有文件夹但是为空 全局cmd,查不到node和npm 已解决
前端·npm·node.js
亮子AI21 小时前
【MySQL】node.js 如何判断连接池是否正确连接上了?
数据库·mysql·node.js
a程序小傲21 小时前
【Node】单线程的Node.js为什么可以实现多线程?
java·数据库·后端·面试·node.js
稀饭521 天前
用changeset来管理你的npm包版本
前端·npm
就知道你是成心的1 天前
npm pack 一键构建npm离线包
npm
程序员爱钓鱼2 天前
Node.js 编程实战:测试与调试 —— Mocha / Jest / Supertest 使用指南
前端·后端·node.js
冴羽2 天前
JavaScript Date 语法要过时了!以后用这个替代!
前端·javascript·node.js
张洪权2 天前
node fs 模块核心 api
node.js