首页 > 解决方案 > 使用 G:用于 Node JS 项目的桌面版 Google Drive(npm 安装错误)

问题描述

桌面版 Google 云端硬盘: 首先,我使用的是“桌面版 Google 云端硬盘”(正式名称为 Google Drive Filestream),这给了我一个 G:我可以在没有互联网连接的情况下从我的计算机访问我的所有 Google 云端硬盘文件和文件夹:https: //support.google.com/a/users/answer/9965580?hl=en

从本质上讲,我们所有计算机上的桌面都设置为同一个 G: 驱动器,因此我们可以在五台计算机中的任何一台上跳,并从任何一台计算机上完全从上次中断的地方开始工作,并且所有桌面文件和文件夹都会同步更改。

Node JS: 在 Hyper 命令提示符下,在 G: 中,我在项目文件夹中创建了 index.js 文件,然后使用npm init. package.json这在项目文件夹中创建了以下文件:

{
  "name": "nodejs",
  "version": "1.0.0",
  "description": "intro to node",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "me",
  "license": "ISC"
}

但是,当我尝试使用 npm install 时,例如:npm install superheroeshttps://www.npmjs.com/package/superheroes我收到以下错误:

npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path G:\My Drive\NodeJS\node_modules\.staging
npm ERR! errno -4075
npm ERR! EEXIST: file already exists, mkdir 'G:\My Drive\NodeJS\node_modules\.staging'
npm ERR! File exists: G:\My Drive\NodeJS\node_modules\.staging
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.  
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<my_user_name>\AppData\Roaming\npm-cache\_logs\2021-05-17T01_14_42_782Z-debug.log

这里有一个类似的帖子:How to make a node.js project in Google Drive Filestream

我尝试删除路径文件名中的空格,My Drive认为这可能会导致 4075 错误,但没有成功。

我知道这不是推荐的做法,因为在这种情况下大多数人会使用 Git Hub,但有可能吗?

谢谢!

标签: javascriptnode.jscommand-linenpm-installgoogle-drive-file-stream

解决方案


嗨我有同样的问题,解决方案很简单,我建议你在你的谷歌驱动器文件夹中创建一个远程存储库并将其克隆到你的计算机文件夹中,当然你应该在本地谷歌驱动器中拥有存储库文件夹。您可以使用 git init --bare 初始化您的远程存储库,我在这里给您一个非常简单的教程


推荐阅读