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.

  1. 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...
  1. 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

  1. I downloaded changeset d7ed71e from the develop branch.
  2. Executed InstallOnWindows.bat (no reported errors).
  3. 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)

Most upvoted comments

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

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.

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 this node.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 the nodeProcessCommandLine attribute from the web.config.

Which version of Node is being used? v12.13.0

  1. Etherpad is reporting Running on Node v12.13.0.
  2. node -- version reports v12.13.0
  3. env shows WEBSITE_NODE_DEFAULT_VERSION=12.13.0

Which version of NPM is being used? MIXED

  1. Etherpad is reporting npm --version: 1.1.37.
  2. npm --version reports 6.12.0
  3. package.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 ... /> in web.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.

exports.port = process.env.PORT || 9001;

It looks like it’s trying to bind to whatever value I have in the settings file, which I assume means that process.env.PORT is returning null?

That line sets the default value. The default is overridden by whatever you have in your settings.json file. To use the PORT environment variable, comment out port in your settings.json.

This was failing because it couldn’t find package.json.

Try this instead:

    - name: npm install, build, and test
      run: |
        cd src
        npm ci
        npm run build --if-present
        npm run test --if-present

it stops without an error code

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…

Enable developer options in Windows. < <<< < < < This is the temporary hack to get symlinks

then:

cd c:\
cd \
git clone https://github.com/ether/etherpad-lite.git
cd etherpad-lite
cd src
npm i --no-optionals
cd..
start.bat

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.

Correct. node_modules\ep_etherpad-lite is supposed to be a symbolic link that points to the src directory. You can tell that it is supposed to be a symlink by running git cat-file -p HEAD:node_modules—the 120000 for the file’s mode means it’s stored in Git as a symlink (regular files are either 100644 or 100755 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-Links

I 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 in src (recursively) into node_modules\ep_etherpad-lite. Or you can try to figure out how to replace node_modules\ep_etherpad-lite with something resembling a symlink, perhaps by enabling Git for Windows’s core.symlinks setting.