Make compatible to Linux/Ubuntu

View original issue on GitHub  ·  Variant 2

Making mcp-scholarly Compatible with Linux/Ubuntu: Permission Denied Error

Users of the mcp-scholarly project may encounter an EACCES: permission denied error when running the software on Linux/Ubuntu systems. This error typically occurs during the installation or configuration phase, specifically when the application attempts to create a directory in the user's home directory.

The error message often looks like this:

node:fs:1371
  const result = binding.mkdir(
                         ^

Error: EACCES: permission denied, mkdir '/home/runner/.config/Claude'
    at Object.mkdirSync (node:fs:1371:26)
    at r.writeConfig (/home/ben/.npm/_npx/2d0620bb1d41b604/node_modules/@smithery/cli/dist/index.js:88:12790)
    at r.installServer (/home/ben/.npm/_npx/2d0620bb1d41b604/node_modules/@smithery/cli/dist/index.js:88:13289)
    at Fi.installServer (/home/ben/.npm/_npx/2d0620bb1d41b604/node_modules/@smithery/cli/dist/index.js:88:17808)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async dP (/home/ben/.npm/_npx/2d0620bb1d41b604/node_modules/@smithery/cli/dist/index.js:95:488)
    at async nSe (/home/ben/.npm/_npx/2d0620bb1d41b604/node_modules/@smithery/cli/dist/index.js:113:2649) {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/home/runner/.config/Claude'
}

Node.js v20.18.0

Root Cause: Insufficient Permissions

The root cause of this issue is typically insufficient permissions for the user running the mcp-scholarly application to create directories and files within their own home directory, specifically within the .config directory. This can happen due to various reasons, including incorrect file ownership or restrictive permissions set on the .config directory or its parent directories.

Solution: Adjusting Permissions

The solution involves granting the user the necessary permissions to create the required directory. Here are a few approaches:

  1. Changing Ownership: You can change the ownership of the .config directory (or its parent) to the current user. Use the chown command:
  2. sudo chown -R $USER:$USER ~/.config
    

    This command recursively (-R) changes the owner and group of the .config directory and all its contents to the current user ($USER).

  3. Granting Write Permissions: Alternatively, you can grant write permissions to the user on the .config directory using the chmod command:
  4. chmod +w ~/.config
    

    This command adds write permissions (+w) to the .config directory for the user.

  5. Creating the Directory Manually: You can attempt to create the directory manually before running the mcp-scholarly application. This can sometimes circumvent permission issues if the parent directory has correct permissions.
  6. mkdir -p ~/.config/Claude
    

    The -p flag ensures that parent directories are created if they don't exist.

Important Considerations and Tips

By addressing the permission issues, you should be able to successfully run mcp-scholarly on your Linux/Ubuntu system.