Npm run init giving fatal: Too many arguments

I wanted to contribute to Brave, I cloned repo and followed the build instructions for ubuntu. I tried many times but npm run init command always took too much time (this is OK because it might be related to my internet connection) but it failed on every time. I remove the folder and clone the repository again. I would like to leave the log here in case someone would find a fix or can anyone tag the related posts:

  • 1. npm run init giving this kind of log
    satya@satya:~/my folder/web Dev/opensource/src/brave$ npm run init

[email protected] init
cd …/…/ && npm run --prefix src/brave sync – --init

[email protected] sync
node ./build/commands/scripts/sync.js --init

depot_tools checkout was interrupted. Cleaning up…
install depot_tools…

/home/satya/my folder/web Dev/opensource/src/brave

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /home/satya/my folder/web Dev/opensource/src/brave/vendor/depot_tools
fatal: Too many arguments.

usage: git clone [] [–] []

-v, --[no-]verbose    be more verbose
-q, --[no-]quiet      be more quiet
--[no-]progress       force progress reporting
--[no-]reject-shallow don't clone shallow repository
-n, --no-checkout     don't create a checkout
--checkout            opposite of --no-checkout
--[no-]bare           create a bare repository
--[no-]mirror         create a mirror repository (implies bare)
-l, --[no-]local      to clone from a local repository
--no-hardlinks        don't use local hardlinks, always copy
--hardlinks           opposite of --no-hardlinks
-s, --[no-]shared     setup as shared repository
--[no-]recurse-submodules[=<pathspec>]
                      initialize submodules in the clone
--[no-]recursive ...  alias of --recurse-submodules
-j, --[no-]jobs <n>   number of submodules cloned in parallel
--[no-]template <template-directory>
                      directory from which templates will be used
--[no-]reference <repo>
                      reference repository
--[no-]reference-if-able <repo>
                      reference repository
--[no-]dissociate     use --reference only while cloning
-o, --[no-]origin <name>
                      use <name> instead of 'origin' to track upstream
-b, --[no-]branch <branch>
                      checkout <branch> instead of the remote's HEAD
-u, --[no-]upload-pack <path>
                      path to git-upload-pack on the remote
--[no-]depth <depth>  create a shallow clone of that depth
--[no-]shallow-since <time>
                      create a shallow clone since a specific time
--[no-]shallow-exclude <revision>
                      deepen history of shallow clone, excluding rev
--[no-]single-branch  clone only one branch, HEAD or --branch
--no-tags             don't clone any tags, and make later fetches not to follow them
--tags                opposite of --no-tags
--[no-]shallow-submodules
                      any cloned submodules will be shallow
--[no-]separate-git-dir <gitdir>
                      separate git dir from working tree
-c, --[no-]config <key=value>
                      set config inside the new repository
--[no-]server-option <server-specific>
                      option to transmit
-4, --ipv4            use IPv4 addresses only
-6, --ipv6            use IPv6 addresses only
--[no-]filter <args>  object filtering
--[no-]also-filter-submodules
                      apply partial clone filters to submodules
--[no-]remote-submodules
                      any cloned submodules will use their remote-tracking branch
--[no-]sparse         initialize sparse-checkout file to include only files at root
--[no-]bundle-uri <uri>
                      a URI for downloading bundles before fetching from origin remote

null

  • my Operating System and version: Ubuntu 24.04
    .I really appreciate your help.
    @Saoiray

@satya-hash unfortunately this type of thing is way over my head. About all I can do is tag someone like @Mattches. Otherwise I’m only able to run through AI, such as the answer from ChatGPT which I’ll paste below:


It looks like there might be an issue with how the paths are being handled in your command. The error message fatal: Too many arguments typically occurs when git clone interprets the space in file paths as multiple arguments.

Here are a few suggestions to resolve the issue:

  1. Check the Directory Paths: Ensure that paths with spaces, like /home/satya/my folder/web Dev/opensource/src/brave, are correctly quoted or escaped. This can prevent git from misinterpreting them. For example, you could use:

    npm run init
    
  2. Use Quotes in Scripts: When the script is running, it might not handle spaces properly. You can manually clone the repository by navigating to the correct directory and using quotes:

    git clone "https://chromium.googlesource.com/chromium/tools/depot_tools.git" "vendor/depot_tools"
    
  3. Create Symbolic Links: Another approach is to create a symbolic link (symlink) to a directory without spaces. For instance:

    ln -s "/home/satya/my folder/web Dev/opensource/src/brave" ~/brave-src
    cd ~/brave-src
    npm run init
    
  4. Modify npm Scripts: If you have control over the npm scripts, you can modify the paths in these scripts to handle spaces correctly by using quotes around the paths.

  5. Internet Connection: Since you mentioned that your internet connection might be slow, consider using a faster connection or running this on a network with better bandwidth. Sometimes, the build process might fail due to timeout issues when fetching large repositories.

  6. Clean Up and Retry: If the repository cloning process was interrupted, there might be leftover files that could cause issues. You can clean up the directory by removing any incomplete files or directories before retrying the commands.

If you try these suggestions and still encounter issues, you can provide additional logs or errors for further assistance.

Thanks @Saoiray for the help, i will try this solution.

I tried the above solution and tried to resolve this issue using AI but no luck,So @Mattches could you please look into this.

I really appreciate your help.Thank you.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.