Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Spaces in Path causes Google Drive errors Windows

So I'm currently experiencing some issues with Google Drive and NPM. I am using the new Google Drive on Windows (if I remember correctly, used to be called Google Filestream).

The issue basically involves the fact that when I do npm install in a Node.JS directory, it tells me that the <PROJECT DIRECTORY>/node_modules folder doesn't exist. Using the same project files and package.json in my local Downloads folder worked absolutely fine and installed everything like it was supposed to.

The full error is as below:

npm ERR! code ENOTDIR
npm ERR! syscall mkdir
npm ERR! path G:\My Drive\Coding\1. Node\1. Discord.JS\SleepBot\node_modules
npm ERR! errno -4052
npm ERR! ENOTDIR: not a directory, mkdir 'G:\My Drive\Coding\1. Node\1. Discord.JS\SleepBot\node_modules'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\stent\AppData\Local\npm-cache\_logs\2022-03-13T17_06_01_171Z-debug.log

If the log file is relevant, please let me know and I will upload it.

And my package.json:

{
  "name": "sleepbot",
  "version": "1.0.0",
  "description": "A custom bot to fix the brat's sleep schedule",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "sleepbot"
  ],
  "author": "Stentorian",
  "license": "ISC",
  "dependencies": {
    "ascii-table": "^0.0.9",
    "chalk": "^4.1.2",
    "cron": "^1.8.2",
    "discord.js": "^13.6.0",
    "fs": "^0.0.1-security",
    "moment": "^2.29.1",
    "ms": "^2.1.3"
  }
}

If anyone could help, that'd be great!

like image 999
bwhybrow23 Avatar asked Sep 16 '25 03:09

bwhybrow23


1 Answers

I think I found a solution! I haven't had a problem since I implemented this.

If you go to the Google Drive settings you can change your syncing options to "Mirror files" (this will download your whole google drive to your computer). It will ask you to select a folder. I suggest changing the default "My Drive" in C:\Users\"yourUserNameHere"\My Drive to "MyDrive" or "My_Drive". Removing the space may spare you the possible problems you may run into. Alternatively, you can select any folder you like but avoiding any spaces in the full path is still recommended.

Assuming you haven't changed any other settings you will still have G:\My Drive but if you navigate to that folder it will just redirect you to the path above.

This should already solve the issue, but if that is not the case just make sure that you are running the commands from the local drive and not G:\...

like image 182
Dmytro Malevskyi Avatar answered Sep 18 '25 16:09

Dmytro Malevskyi