【问题标题】:Npm install issue on Virtualbox with Ubuntu installed安装了 Ubuntu 的 Virtualbox 上的 Npm 安装问题
【发布时间】:2017-11-13 11:59:29
【问题描述】:

只是想知道是否有人可以对在 Virtualbox 机器上运行的 npm install 有所了解(安装了 Ubuntu v16.4).. 我很抱歉这个错误

osboxes@osboxes:/media/sf_ubuntu/angular$ npm install
app@0.0.0 /media/sf_ubuntu/angular
├── UNMET PEER DEPENDENCY @angular/compiler@2.2.3
└── UNMET PEER DEPENDENCY @angular/core@2.2.3

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN codelyzer@1.0.0-beta.3 requires a peer of @angular/compiler@~2.1.1 but none was installed.
npm WARN codelyzer@1.0.0-beta.3 requires a peer of @angular/core@~2.1.1 but none was installed.
npm WARN app@0.0.0 No repository field.
npm ERR! Linux 4.8.0-22-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path ../acorn/bin/acorn
npm ERR! code EROFS
npm ERR! errno -30
npm ERR! syscall symlink

npm ERR! rofs EROFS: read-only file system, symlink '../acorn/bin/acorn' -> '/media/sf_ubuntu/angular/node_modules/.bin/acorn'
npm ERR! rofs This is most likely not a problem with npm itself
npm ERR! rofs and is related to the file system being read-only.
npm ERR! rofs 
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.

npm ERR! Please include the following file with any support request:
npm ERR!     /media/sf_ubuntu/angular/npm-debug.log
npm ERR! code 1

【问题讨论】:

  • 是否为您的共享 Virtualbox 文件夹选择了“只读”?
  • 什么是 /media/sf_ubuntu/angular ?它是网络路径还是可移动驱动器?如果是这样,您需要检查其权限。
  • 这似乎是一个权限问题。我不得不将 package.json 移动到 ubuntu HDD 内的文件夹中。现在运行正常。谢谢

标签: node.js ubuntu npm webpack virtualbox


【解决方案1】:

为了安全起见,Virtualbox 限制了在共享目录中创建符号链接。所以你应该打开相关功能:

  1. 关闭虚拟机

  2. 将Virtualbox的安装路径添加到环境变量PATH中

  3. 在cmd中执行下面的命令

    VBoxManage setextradata <VM_NAME> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SHARE_NAME(without the sf_ prefix)> 1

  4. 以管理员身份运行 Virtualbox

【讨论】:

  • 不知何故,上面显示的代码不完整。完整的代码在这里。 VBoxManage setextradata VBoxInternal2/SharedFoldersEnableSymlinksCreate/ 1
猜你喜欢
  • 2021-04-12
  • 1970-01-01
  • 2018-10-11
  • 2011-09-17
  • 2017-08-23
  • 2015-05-24
  • 2019-10-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多