etherpad-lite: Unable to find packages.json on Windows Manual Install
Describe the bug
I grabbed the latest changeset, d7ed71e, on the develop branch. I think issue #4787 has been resolved, but I’m getting an error that packages.json cannot be found.
Relevant snippet:
[ERROR] npm - npm ERR! error in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\node_modules\ep_etherpad-lite: ENOENT: no such file or directory, open 'C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\node_modules\ep_etherpad-lite\package.json'
The file ep_etherpad-lite exists and the contents are “…/src”. If use a file explorer to navigate up one level and into /src, I find packages.json. I don’t think Windows supports using a file for path redirection this way. I tried replacing ep_etherpad-lite with a shortcut, but that didn’t work. I deleted ep_etherpad-lite, created a folder in its place and copied packages.json into this folder: that caused this issue to go away and start.bat seems to run successfully.
However, start.bat auto exits and returns to the command line and there doesn’t appear to be a server running in the background. I don’t know if that is a side effect of the change I described above. I then tried using node src/node/server.js to start the server instead, but auto-quits in the same way.
- Here’s the complete log from before I started playing with the ep_etherpad-lite file.
C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop>start.bat
C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop>node src\node\server.js
[2021-02-16 19:00:20.780] [DEBUG] console - Running on Node v14.15.5 (minimum required Node version: 10.17.0)
[2021-02-16 19:00:20.793] [INFO] console - All relative paths will be interpreted relative to the identified Etherpad base dir: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop
[2021-02-16 19:00:20.794] [INFO] console - Random string used for versioning assets: 04155d40
[2021-02-16 19:00:20.795] [DEBUG] AbsolutePaths - Relative path "settings.json" can be rewritten to "C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\settings.json"
[2021-02-16 19:00:20.796] [DEBUG] AbsolutePaths - Relative path "credentials.json" can be rewritten to "C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\credentials.json"
[2021-02-16 19:00:20.797] [WARN] console - No settings file found in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\settings.json. Continuing using defaults!
[2021-02-16 19:00:20.797] [INFO] console - No credentials file found in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\credentials.json. Ignoring.
[2021-02-16 19:00:20.798] [WARN] console - No "skinName" parameter found. Please check out settings.json.template and update your settings.json. Falling back to the default "colibris".
[2021-02-16 19:00:20.799] [INFO] console - Using skin "colibris" in dir: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\static\skins\colibris
[2021-02-16 19:00:20.799] [INFO] console - Session key file "C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\SESSIONKEY.txt" not found. Creating with random contents.
[2021-02-16 19:00:20.800] [WARN] console - DirtyDB is used. This is not recommended for production. File location: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\var\dirty.db
[2021-02-16 19:00:21.142] [INFO] server - Starting Etherpad...
[2021-02-16 19:00:21.180] [INFO] runNpm - Executing command: npm ls --long --json --depth=0
[2021-02-16 19:00:21.330] [INFO] runNpm - npm --version: 6.14.11
[2021-02-16 19:00:21.615] [ERROR] npm - npm ERR! error in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\node_modules\ep_etherpad-lite: ENOENT: no such file or directory, open 'C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\node_modules\ep_etherpad-lite\package.json'
[2021-02-16 19:00:21.623] [ERROR] runNpm - npm command failed: npm ls --long --json --depth=0
[2021-02-16 19:00:21.624] [ERROR] server - Error occurred while starting Etherpad
[2021-02-16 19:00:21.625] [ERROR] server - Error: Command exited non-zero: npm ls --long --json --depth=0
at exports (C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\node\utils\run_cmd.js:71:25)
at exports (C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\node\utils\run_npm.js:25:13)
at Object.exports.getPackages (C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\static\js\pluginfw\plugins.js:73:14)
at Object.exports.update (C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\static\js\pluginfw\plugins.js:56:34)
at Object.exports.start (C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\node\server.js:137:19)
[2021-02-16 19:00:21.625] [INFO] server - Exiting...
[2021-02-16 19:00:21.626] [INFO] server - Waiting for Node.js to exit...
- Log from after I deleted the ep_etherpad-lite file and copied packages.json into a new folder in its place.
C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop>node ./src/node/server.js
[2021-02-16 19:34:11.334] [DEBUG] console - Running on Node v12.20.2 (minimum required Node version: 10.17.0)
[2021-02-16 19:34:11.348] [INFO] console - All relative paths will be interpreted relative to the identified Etherpad base dir: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop
[2021-02-16 19:34:11.349] [INFO] console - Random string used for versioning assets: 5a4d5cee
[2021-02-16 19:34:11.349] [DEBUG] AbsolutePaths - Relative path "settings.json" can be rewritten to "C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\settings.json"
[2021-02-16 19:34:11.350] [DEBUG] AbsolutePaths - Relative path "credentials.json" can be rewritten to "C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\credentials.json"
[2021-02-16 19:34:11.350] [WARN] console - No settings file found in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\settings.json. Continuing using defaults!
[2021-02-16 19:34:11.351] [INFO] console - No credentials file found in C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\credentials.json. Ignoring.
[2021-02-16 19:34:11.351] [WARN] console - No "skinName" parameter found. Please check out settings.json.template and update your settings.json. Falling back to the default "colibris".
[2021-02-16 19:34:11.352] [INFO] console - Using skin "colibris" in dir: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\src\static\skins\colibris
[2021-02-16 19:34:11.352] [INFO] console - Session key loaded from: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\SESSIONKEY.txt
[2021-02-16 19:34:11.352] [WARN] console - DirtyDB is used. This is not recommended for production. File location: C:\Users\alexe\Downloads\etherpad-lite-develop-d7ed71e\etherpad-lite-develop\var\dirty.db
[2021-02-16 19:34:11.694] [INFO] server - Starting Etherpad...
[2021-02-16 19:34:11.731] [INFO] runNpm - Executing command: npm ls --long --json --depth=0
[2021-02-16 19:34:11.875] [INFO] runNpm - npm --version: 6.14.11
[2021-02-16 19:34:12.178] [INFO] runNpm - Successfully ran command: npm ls --long --json --depth=0
[2021-02-16 19:34:12.178] [INFO] server - Installed plugins:
[2021-02-16 19:34:12.179] [INFO] server - Etherpad is running
To Reproduce
- I downloaded changeset d7ed71e from the develop branch.
- Executed InstallOnWindows.bat (no reported errors).
- Executed start.bat and the above error was reported.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 83 (33 by maintainers)
Interesting. The error from @alexeisenhart with rjquery is thrown from pad.html (before ace.js runs) while your error seems to be thrown later when initializing Ace2Editor.
Wow well done mate
YES!
Yeah, let’s do it. Might as well be on the latest and greatest at this point =) Thank you! I’m going to step away for lunch.
Wait… https://github.com/ether/etherpad-lite/blob/develop/src/static/js/pluginfw/plugins.js#L17 - is where it’s showing version…
replace
npm
with an absolute path IE\program files x86\npm\6.9.0\npm
or whatever is the correct path.Btw note this: https://github.com/ether/etherpad-lite/blob/develop/src/node/utils/run_cmd.js#L52
Sorry, haven’t had time to respond to this tomorrow my time but will reply tomorrow early GMT 😃
Hey @RyanHill-MSFT and @JohnMcLear
Long story short, I think Etherpad is grabbing the wrong NPM version in Azure.
I was deploying the
node.exe
that was shipped in the Etherpad Windows zip release. The web.config was directing Etherpad uses thisnode.exe
(nodeProcessCommandLine=“C:\home\site\wwwroot\node.exe”) so the version reported at start up is correct (Node v12.20.2). However I noticed in the logs that it’s loading NPM 1.1.37.Now, I deleted
node.exe
from the site root and removed thenodeProcessCommandLine
attribute from the web.config.Which version of Node is being used? v12.13.0
Running on Node v12.13.0
.node -- version
reportsv12.13.0
env
showsWEBSITE_NODE_DEFAULT_VERSION=12.13.0
Which version of NPM is being used? MIXED
npm --version: 1.1.37
.npm --version
reports 6.12.0package.json
indicates 6.14.11 (if that is relevant)Node seems to be good, but NPM is not. Ryan, how is the NPM version in Azure assigned?
@alexeisenhart, just set your node version to whatever your app need.
Don’t run server.js manually in the Console. I don’t think that will get your anywhere. Enable all your logging, no need to hook Azure Monitor right now, and redeploy everything starting fresh. Add
loggingeEnabled=true
to<iisnode ... />
inweb.config
. Check your deployment logs for any errors or warnings. If all is good there, then check application logs for any errors during app startup.That line sets the default value. The default is overridden by whatever you have in your
settings.json
file. To use thePORT
environment variable, comment outport
in yoursettings.json
.Try this instead:
Are you sure that it stops? The line in the log that says “
runNpm - npm --version: 6.14.11
” is printed just as Etherpad runs npm to discover installed plugins. The npm CLI is slow, so maybe it’s just taking a while? It should take less than 60s to return.If it is indeed stopping but the logs don’t show anything, I wonder if it’s a Windows-specific log buffering issue. Maybe the process is dying and Windows isn’t flushing buffered writes so you can’t see the printed error message.
Yea this is due to the changes you made, 100%. I should be able to get @rhansen able to know the PR that broke the windows build.
For a clean windows build you can just use…
then:
Correct.
node_modules\ep_etherpad-lite
is supposed to be a symbolic link that points to thesrc
directory. You can tell that it is supposed to be a symlink by runninggit cat-file -p HEAD:node_modules
—the120000
for the file’s mode means it’s stored in Git as a symlink (regular files are either100644
or100755
depending on whether they’re executable or not). Unfortunately, Windows doesn’t handle symbolic links well: https://github.com/git-for-windows/git/wiki/Symbolic-LinksI haven’t used Windows in ages, so I don’t know what the “right” fix is. The quick-and-dirty fix would be to replace
node_modules\ep_etherpad-lite
with a directory and copy everything insrc
(recursively) intonode_modules\ep_etherpad-lite
. Or you can try to figure out how to replacenode_modules\ep_etherpad-lite
with something resembling a symlink, perhaps by enabling Git for Windows’score.symlinks
setting.