npm install 报错

1、[email protected] postinstall: node scripts/postinstall verbose stack Error: [email protected] 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) 
相关推荐
HWL567927 分钟前
Express项目解决跨域问题
前端·后端·中间件·node.js·express
爱编程的小学究3 小时前
【node】如何把包发布到npm上
前端·npm·node.js
2501_915373883 小时前
全栈项目实战:Vue3+Node.js开发博客系统
node.js
狂野小青年5 小时前
npm 报错 gyp verb `which` failed Error: not found: python2 解决方案
前端·npm·node.js
鲁鲁5175 小时前
Windows 环境下安装 Node 和 npm
前端·npm·node.js
Vone_6614 小时前
node.js 邮箱验证服务器搭建
运维·服务器·node.js
程序员拂雨15 小时前
HTTP和HTTPS模块
http·https·node.js
dgiij20 小时前
excel大表导入数据库
数据库·mysql·node.js·excel
x-cmd21 小时前
[250512] Node.js 24 发布:ClangCL 构建,升级 V8 引擎、集成 npm 11
前端·javascript·windows·npm·node.js