使用 Yarn on Parallels 安装节点模块时出现问题 (Windows 10)

问题描述 投票:0回答:2

我需要使用 Parallels(开发人员)将 Electron 项目从本机 Windows 10 切换到 Mac OS 上的虚拟 Windows 10 计算机。 Nodejs 和 Yarn 安装很顺利,但是当我尝试安装 /yarn 项目的节点模块时,出现了一堆错误,这些错误似乎与虚拟机的目录结构有关。

[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/6] ⡀ core-js
[2/6] ⡀ core-js
[3/6] ⡀ node-sass
[4/6] ⡀ deasync
error \\mac\Home\Documents\Development\theproject\node_modules\deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments: 
Directory: \\mac\Home\Documents\Development\theproject\node_modules\deasync
Output:
"\\mac\Home\Documents\Development\theproject\node_modules\deasync"

此外,CMD.EXE 还会抛出错误(由于是德语而总结),表示不支持 UNC 路径并且路径设置为 Windows。因此我猜想如下

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Windows\build.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {

我不会起诉,如果两个问题都有相同的原因,即不受支持的 UNC 路径以及如何解决此问题。任何帮助表示赞赏。

node.js yarnpkg parallels
2个回答
0
投票

关闭 Parallels 中的桌面/文件夹共享并使用

yarn add --dev node-sass
手动安装 node-sass 解决了问题。


0
投票

使用npm缓存解决这个错误

© www.soinside.com 2019 - 2024. All rights reserved.