foreversd / forever

A simple CLI tool for ensuring that a given script runs continuously (i.e. forever)

Home Page:http://github.com/foreverjs/forever

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[node v14.x+] Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

SwapnilSoni1999 opened this issue · comments

The new node version doesn't let process to start. whenever

$ forever start app.js

is executed it shows the following warning

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: bot.js
(node:14545) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14545) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

and after this if I check with forever list it shows no process is running.

(node:14574) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14574) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
info:    No forever processes running

@SwapnilSoni1999 I'll take a look, thanks for the report.

@kibertoad

On the following platforms:

Ubuntu 20.04 LTS

Package: nodejs
Version: 14.1.0-deb-1nodesource1

'padLevels' warnings
❌ script runs

Mac OS X 10.13.6

Package: node
Version: stable 14.1.0 (bottled)

'padLevels' warnings
✅ script runs

Me too, script doesn't run and I get the warnings - Node v14.2.0 (Arch Linux)

Me too, script doesn't run and I get the warnings - Node v14.2.0 (Arch Linux)

same here checked on ubuntu 20.04 and archlinux too

Please refer to #1075 for more info.

Please refer to #1075 for more info.

please explain a bit how this issue is related to the issue you mentioned.
Thanks

Same problem with Nodejs Ver 10 and forever 2.0 wont start on windows 10 server 2016... changed roblav96 suggestion #1075 in monitor to string for the file system for the pid and last line erase extra New Line... with same error but different node addresses every time complaining about padLevels... the process does not start ... please help

Unfortunately this cannot be easily fixed on forever side - reason for the problem is this - winstonjs/winston#1797

Best solution would be to drop dependency on Winston altogether and replace it with something like pino, but unfortunately that would take way more time than I currently have.

PRs welcome. In the meantime, I would recommend to use alternatives to forever, such as pm2 or nodemon on Node 14.

@SwapnilSoni1999 I don't think it should prevent application from starting, it's just a warning. As @naeem518 has mentioned, there was another problem, that was fixed in #1075, that might have prevented forever from working in certain cases. You can try forever 3.0.0 and see if it works any better for you.

@kibertoad sure sir just give some time and I'll check

@kibertoad Thank you for releasing new version!
I confirmed that new version works without errors on linux with latest nodejs version.

Confirming with @sapics said.

I am on Ubuntu@16.04, Node@14.2.0. After upgrading from Forever 2.X to Forever 3.0.0, forever start still shows me the error

(node:9923) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9923) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

But at least the forever process starts and continues to run unlike before!

Hi @akircher !
It is not error, but warning. Thus, your program would work as you noticed.
The warning come from the other program (winston) which used by forever.

Still having this problem over a month from this being logged.

Still having this problem over a month from this being logged.

which os?

You can update your dependencies to winston@2.4.5 which should resolve this issue.

Any news when it'll be a fix? adding winston@2.4.5 also not working.
Same problem: forever start not starting anything.

winston@3.x has been released quite some time ago. Would upgrading to v3 fix this issue?

https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md

Is there any solution to this please?

I'm running:

  • Ubuntu Server 20.04
  • NPM v6.14.8
  • Node v14.13.0
  • Forever v3.0.2

...and I'm getting the following error:

info: Forever processing file: index.js
(node:5208) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

...and, nothing runs :(

I am the exact same as @KemikalGeneral except node v14.13.1. Running on a Linux server (standard Amazon EC2 Linux image).
Getting the exact same padLevels error. It pops up even when just doing forever --version.

Using official docker image for node 14.13.1 (-stretch) and Forever 3.0.2 and I get:

$ forever --version
v3.0.2
(node:5965) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)

  • Forever: v3.0.2
  • Node: v14.15.0 [I use node version manager (nvm) for windows]
  • OS: Windows 10 (10.0.19042)
  • Dicker: No

project_name@0.0.0 watch C:\Projects\project_name
npm run watch:forever

project_name@0.0.0 watch:forever C:\Projects\project_name
forever start bin/www --watch

warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: bin/www
(node:6632) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:6632) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

Steps to reproduce

npx express-generator --view twig
set watch on scripts with "forever start bin/www --watch" value
run on terminal "npm run watch"

If someone would contribute a PR to update Winston version used in forever, that might help (if they fixed the issue there)

I had the same issue after updating my Nodejs to version 14, but after checking the warnings I realised the problem was caused because of using an old version of npm package for Sqreen (Sqreen protects applications against common security threats). As soon as I updated my Sqreen package, my issue was solved.

Use trace warning command to get detailed information of the warnings.

Also getting the same errors as above

  • Node: v15.2.1
  • Forever: v3.0.4
  • OS: Ubuntu 16.04.4 LTS

And I have the same error, Node: v15.2.1, Forever: v3.0.4, OS: Windows 10.

And I have the same error, Node: v15.2.1, Forever: v3.0.4, OS: Centos 7

As a workaround, I installed NVM and dialed back to node v12.20.0

$ nvm install 12.20.0

As a workaround, I installed NVM and dialed back to node v12.20.0

$ nvm install 12.20.0

and we dont want that

  • exports inside the circular dependency
    This phase gave hint to solve the same issue for me, it seems that newer NodeJS versions no longer allows the circular dependencies.
    Eg -
    There are two files - FileA.js, FileB.js
    Where FileA.js has
    const FileB = require("FileB");
    and FileB.js has
    const FileA = require("FileA");

After removing one of this it worked!

same here

forever --version
v3.0.4
(node:503) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)

(node:18643) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)

PLEASE STOP the "same here" posts. We all get it, everyone has this problem. If you want to "vote", then just thumbs up one of these. Those of us watching this thread don't need a new notification everyone someone says "me too".

SAME HERE

  • exports inside the circular dependency
    This phase gave hint to solve the same issue for me, it seems that newer NodeJS versions no longer allows the circular dependencies.
    Eg -
    There are two files - FileA.js, FileB.js
    Where FileA.js has
    const FileB = require("FileB");
    and FileB.js has
    const FileA = require("FileA");

After removing it worked!

Could you please specify what needs to be corrected and the file?

  • exports inside the circular dependency
    This phase gave hint to solve the same issue for me, it seems that newer NodeJS versions no longer allows the circular dependencies.
    Eg -
    There are two files - FileA.js, FileB.js
    Where FileA.js has
    const FileB = require("FileB");
    and FileB.js has
    const FileA = require("FileA");

After removing it worked!

Could you please specify what needs to be corrected and the file?

Just remove one import in any of the files if possible.

works with 14.10.1

I have 14.15.1 installed, and it's happening in that version for sure.

Yep, still happening - any progress?

Anyone with any solution?

I don't know wheter can helps in your cases, but in my case i deleted /root/.forever/insta-scheduler.log this logfile and after that forever started

I'm done using forever.

@elias89 Same I moved to PM2

I'm facing the same issue.
I'm using Nodejs v14.17.3, Forever v4.0.1 and Winston v3.3.3.
I'm able to start the process, but see the above mentioned warnings.
Can anyone help me silencing those warnings.

@akhila9996

You can set the env var NODE_NO_WARNINGS=1 and it goes away, at least it did for me (I'm using the same node & winston version as you)

after so long, is there any solution for that?
i am just using hepipe.js with forever.

if i do forever list i see the forever process up and running, but i still can see the warning there.
is reverting to Node.JS 12 the only way to solve this?

OS: Debian Bullseye
_
npm -v
6.14.15
node -v
v14.17.6
forever --version
v4.0.1
(node:2334156) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)

forever list
(node:2341766) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:2341766) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
info: Forever processes running
data: uid command script forever pid id logfile uptime
data: [0] QOte /usr/bin/node hepipe.js 2265184 2265468 /var/log/forever/QOte.log 0:0:9:6.956000000000017

_

I've given up with forever, I have to update Node and this bug is an insurmountable problem. There are alternatives out there.

I've given up with forever, I have to update Node and this bug is an insurmountable problem. There are alternatives out there.

use pm2

commented

hai guys I'm facing the same issues
(node:10600) Warning: Accessing non-existent property 'padLevels' of module exports inside the circular dependency
once I ran the command - node --trace-warnings ...
I'm getting the below error.
internal/modules/cjs/loader.js:905
throw err;
^

Error: Cannot find module 'D:\GitHub\kidscare...'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

commented

n 13
will fix this problem

@polkila downgrading to 13 (for me) is not an option, I need at least v15 and latest version is 17

commented

@rushglen Yep! Install 2 versions in parallel:
n 17 , then n 13;
then type n list to find what version exactly do you use (for example, you will see 17.0.1 in the list).
Then n bin 17.0.1 to print path to binary file.
And finally, use this path with forever: forever start -c '/usr/local/n/versions/node/17.0.1/bin/node' app.js for running app.js inside v17

hai guys I'm facing the same issues (node:10600) Warning: Accessing non-existent property 'padLevels' of module exports inside the circular dependency once I ran the command - node --trace-warnings ... I'm getting the below error. internal/modules/cjs/loader.js:905 throw err; ^

Error: Cannot find module 'D:\GitHub\kidscare...' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

You sure its issue from forever ?

Having the same issue Ubuntu 18.04.4, node 14.18.1, forever 4.01

What I am using as a work around currently, is running sudo forever. That works perfectly, with no errors. As soon as I run forever as user, it breaks with the error.

forever is installed globally.

Having the same issue Ubuntu 18.04.4, node 14.18.1, forever 4.01

What I am using as a work around currently, is running sudo forever. That works perfectly, with no errors. As soon as I run forever as user, it breaks with the error.

forever is installed globally.

I assume you're using nvm
And sudo is accessing some other node version
have you checked with sudo node --version?

You can update your dependencies to winston@2.4.5 which should resolve this issue.

Took a stab at upgrading to the latest version of winston (which is currently 3.4.0)

#1128

May someone check if new version https://www.npmjs.com/package/forever/v/4.0.3 has fixed the problem?
I myself still having this: #1128 (comment)

At least it seems to let me run forever.

It looks like a little more fixing will be needed. Specifically, flatiron/cliff#11 needs to get merged and then forever needs to depend on that new version of cliff. (Even after that there may be other instances of similar warnings lurking somewhere.)

We have:

  1. Flatiron (7y dead) depends on broadway 0.3.2.
  2. Broadway (3y dead) from 1.0.0 (4.1.0 now) is not compatible to 0.3.x
  3. Broadway 0.3.6 (last from 0.x.x) depends both on Winston and Cliff
  4. Cliff (7y dead) depends on Winston too.

I've taken a look and couldn't fix fast.

All this inheritance looks like a dead end for me in using Forever :(
It really served well.

Yes. Unfortunately, forever is deeply rooted in very outdated libraries.

I'm not familiar with any of the libraries @2naive listed, except for just looking at them just now. But it looks like forever is only using flatiron for its CLI flag parsing, so it might be possible to switch forever to use yargs or something. Then you'd reduce the number of external dependencies that need updating/forking to just Cliff, hopefully.

@MatrixFrog I would prefer using getopts, because yargs comes with its own set of dependencies.

Specifically, flatiron/cliff#11 needs to get merged

I manually applied the changes described in that PR and so far, with my limited testing, I haven't seen any more warnings. If anyone wants to do the same, make sure to use the updated fix as mentioned in the thread.

This doesn't help when using forever as a dependency in a project but my global install at least has clean logs again.

I have just updated to forever v4.0.3 and still receive the padlevels error.
env:
Debian v4.9.144-3.1
Node v14.18.3
Forever v4.0.3

Due to the error my process will not run. I can run it manually, so I know there is not an issue with the application.
I am using the options file form of the start command.
If I specify all the options I want on the command line, the process starts, but I still get the error messages.

For what it's worth downgrading from node 14 to node 12 seems to make the problem go away.

I'm also seeing the padLevels circular dependency error with the current release of forever (v4.0.3) and node v14[.16.0 in my case]. However I'm pretty sure the issue was not introduced in forever v4 because I had the same issue in forever v2.0.0. I only upgraded to v4 with the hope of making the problem go away.

I think the root problem may have been introduced in some dependency of forever, but I have not tried to hunt to down which one. Specifically, here's what I'm seeing:

  1. forever v2 has been very stable for me for a long time. I've being running multiple production apps with that under node v10, v12, and v14 for quite some time. This includes fresh, from scratch npm install deployments of these apps - as recently as today - not just old-and-still running instances.
  2. Many of the dependencies used by these apps are pinned to specific versions in package.json (of course?), which are periodically updated based on need and npm outdated reporting.
  3. I just now updated a number of these other dependencies (notably not forever, which has been pinned at =v2.0.0), and suddenly encountered this issue. Upgrading to forever v4 didn't change anything. Downgrading to node v12 does seem to work though (with both forever v2 and v4).

That is, I'm pretty sure what I've seen is (1) a fresh, from-scratch install of the app was working fine, (2) I updated several of my app's other dependencies (mostly express-related) by pinning to the latest version in package.json and re-running npm install, (3) suddenly forever is having this problem (even outside of my app, i.e., forever --help shows the circular dependency error too). To be honest I'm not sure if I fully understand npm's logic for sharing overlapping second-order+ dependencies, but it seems likely to me that updating these other modules must have bumped up the version of some tertiary dependency that forever is also using and that somehow triggered the issue.

As mentioned above, downgrading from node 14 to node 12 seems to make the problem go away. That's good enough for me for now (for test/dev purposes at least) but assuming this issue isn't fixed in forever (or something upstream), personally it may be easier or better to finally migrate to pm2 rather than to try to hunt down the exact cause myself. I've been happy with forever since it has been working fine for me since, well, forever, so there's been no reason to change it but pm2 seems to be the conventional choice for this functionality for most node developers.

EDIT: I just now noticed that this issue was reported not in May of this year but May of 2020. If this isn't a topic that the forever dev team is willing to address maybe they should just flag the module as deprecated/unsupported. I agree this doesn't look like a direct issue in forever, but it is an issue that you can recreate from forever --help alone, so there must be something upstream at least that's causing the issue.

I'm done using forever.

@agnoam

Forever is correctly working within this warning Accessing non-existent property 'padLevels' of module exports inside circular dependency. For those which mention that forever processes are not running they are probably using forever version < 3.0.0 - in this case you can see in logs The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (xyz) so you must upgrade to forever version v3.0.0 at least. This bug is fixed in v3.0.0 although author does not mention it in changelog: https://github.com/foreversd/forever/blob/master/CHANGELOG.md#300--fri-22-may-2020

Using node v18.18.2 and forever v4.0.3 I still have the error