Unitech / Unitech/pm2

npm removes installed Coffeescript after running any npm install

Open
#5,296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

npm removes installed coffeescript
after installing > pm2 install coffeescript
running coffeescript files works fine
but
after running for example > npm i dot
(actually it was already installed, so just "empty" run of npm)
npm removes installed coffeescript (maybe because it was installed in main folder by > npm i coffeescript)
now running coffeescript gives error that no coffeescript installed

node version v16.13.2, npm version 8.1.2, Ubuntu 20.04

my solution

instead of > pm2 install coffeescript
do
ln -s ~/node_modules/.bin/coffee ~/node_modules/pm2/node_modules/.bin/coffee

How could we reproduce this issue?

pm2 install coffeescript
ls ~/node_modules/pm2/node_modules/
-- shows installed coffeescript libraries
running npm start test.coffee - ok
npm delete test
npm i dot
ls ~/node_modules/pm2/node_modules/
-- no coffeescript modules
running npm start test.coffee gives error:
[PM2][ERROR] Interpreter /home/jj/node_modules/pm2/node_modules/.bin/coffee is NOT AVAILABLE in PATH. (type 'which /home/jj/node_modules/pm2/node_modules/.bin/coffee' to double check.)

Supporting information

$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date                 : Tue Feb 08 2022 08:07:02 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.1.2
node version         : 16.13.2
node path            : /home/jj/node_modules/.bin/pm2
argv                 : /home/jj/.nvm/versions/node/v16.13.2/bin/node,/home/jj/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : jj
uid                  : 1000
gid                  : 1000
uptime               : 884min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.1.2
node version         : 16.13.2
node path            : /home/jj/node_modules/.bin/pm2
argv                 : /home/jj/.nvm/versions/node/v16.13.2/bin/node,/home/jj/node_modules/.bin/pm2,report
argv0                : node
user                 : jj
uid                  : 1000
gid                  : 1000
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
cpus nb              : 4
freemem              : 618680320
totalmem             : 2147483648
home                 : /home/jj
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name              │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼───────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ jj_app_cluster    │ default     │ N/A     │ fork    │ 30487    │ 2m     │ 1    │ online    │ 0%       │ 142.2mb  │ jj       │ enabled  │
└─────┴───────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/jj/.pm2/pm2.log last 20 lines:
PM2        |     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
PM2        |     at onErrorNT (node:internal/child_process:477:16)
PM2        |     at processTicksAndRejections (node:internal/process/task_queues:83:21)
PM2        | 2022-02-08T07:51:09: PM2 log: App [jj_app_cluster:0] starting in -fork mode-
PM2        | 2022-02-08T07:51:09: PM2 log: App [jj_app_cluster:0] online
PM2        | 2022-02-08T07:51:09: PM2 error: Error: spawn /home/jj/node_modules/pm2/node_modules/.bin/coffee ENOENT
PM2        |     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
PM2        |     at onErrorNT (node:internal/child_process:477:16)
PM2        |     at processTicksAndRejections (node:internal/process/task_queues:83:21)
PM2        | 2022-02-08T07:54:59: PM2 log: [Watch] Stop watching jj_app_cluster
PM2        | 2022-02-08T07:54:59: PM2 log: Stopping app:jj_app_cluster id:0
PM2        | 2022-02-08T07:54:59: PM2 error: app=jj_app_cluster id=0 does not have a pid
PM2        | 2022-02-08T08:01:37: PM2 log: [Watch] Start watching jj_app_cluster
PM2        | 2022-02-08T08:01:37: PM2 log: App [jj_app_cluster:0] starting in -fork mode-
PM2        | 2022-02-08T08:01:37: PM2 log: App [jj_app_cluster:0] online
PM2        | 2022-02-08T08:04:12: PM2 log: Stopping app:jj_app_cluster id:0
PM2        | 2022-02-08T08:04:13: PM2 log: App [jj_app_cluster:0] exited with code [0] via signal [SIGINT]
PM2        | 2022-02-08T08:04:13: PM2 log: pid=30462 msg=process killed
PM2        | 2022-02-08T08:04:13: PM2 log: App [jj_app_cluster:0] starting in -fork mode-
PM2        | 2022-02-08T08:04:13: PM2 log: App [jj_app_cluster:0] online

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported reproduction: pm2 install coffeescript, then npm i dot, and verify the PM2 module and .bin/coffee paths. Trace the PM2 install and interpreter-resolution entry points involved in those commands. Done means a CoffeeScript interpreter installed through PM2 remains available after a subsequent npm install, with the provided reproduction no longer producing ENOENT.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.