前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >排障集锦:九九八十一难之第十六难!-------------enoent ENOENT: no such file or directory, open ‘/root/package.json‘

排障集锦:九九八十一难之第十六难!-------------enoent ENOENT: no such file or directory, open ‘/root/package.json‘

作者头像
不吃小白菜
发布2020-09-17 17:36:13
2.4K1
发布2020-09-17 17:36:13
举报
文章被收录于专栏:用户7721898的专栏

npm全称为Node Package Manager,是一个基于Node.js的包管理器

npm install 安装之前,npm install 会先检查,node_modules 目录之中是否已经存在指定模块

报错信息如下

代码语言:javascript
复制
[root@node1 ~]# npm run start &
[1] 58104
[root@node1 ~]# npm ERR! path /root/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-14T13_51_52_203Z-debug.log

[1]+  退出 254              npm run start

查看日志报错信息如下

代码语言:javascript
复制
[root@node1 ~]# cat /root/.npm/_logs/2020-09-14T13_46_01_150Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using npm@5.3.0
3 info using node@v8.2.1
4 verbose config Skipping project config: /root/.npmrc. (matches userconfig)
5 verbose stack Error: ENOENT: no such file or directory, open '/root/package.json'
6 verbose cwd /root
7 verbose Linux 3.10.0-957.el7.x86_64
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
9 verbose node v8.2.1
10 verbose npm  v5.3.0
11 error path /root/package.json
12 error code ENOENT
13 error errno -2
14 error syscall open
15 error enoent ENOENT: no such file or directory, open '/root/package.json'
16 error enoent This is related to npm not being able to find a file.
17 verbose exit [ -2, true ]

解决方案

代码语言:javascript
复制
[root@node1 src]# cd elasticsearch-head/   '回到安装nodejs文件下 进行重新初始化'
[root@node1 elasticsearch-head]# npm install
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/karma/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression

重新启动

代码语言:javascript
复制
[root@node1 elasticsearch-head]#  npm run start &
[1] 58150
[root@node1 elasticsearch-head]# 
> elasticsearch-head@0.0.0 start /usr/local/src/elasticsearch-head
> grunt server

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

[root@node1 elasticsearch-head]# netstat -ntap | grep 9100
tcp        0      0 0.0.0.0:9100            0.0.0.0:*               LISTEN      58160/grunt    
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/09/14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 报错信息如下
  • 查看日志报错信息如下
  • 解决方案
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档