Vbox虚拟机内在共享目录中创建软链接失败

29 篇文章 0 订阅
13 篇文章 0 订阅

使用yarn运行一个前端项目时报了个错:

tianlang@tianlang-VirtualBox:/data/code/java/master$ yarn

yarn install v1.22.10

$ echo $npm_execpath | grep -q yarn || echo '\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\033[0m'

[1/5] Validating package.json...

[2/5] Resolving packages...

[3/5] Fetching packages...

info fsevents@1.2.13: The platform "linux" is incompatible with this module.

info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.

info fsevents@2.1.3: The platform "linux" is incompatible with this module.

info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.

[4/5] Linking dependencies...

warning " > @cypress/webpack-preprocessor@4.1.5" has incorrect peer dependency "webpack@^4.18.1".

warning " > @testing-library/cypress@5.3.1" has incorrect peer dependency "cypress@^2.1.0 || ^3.0.0 || ^4.0.0".

warning " > eslint-loader@4.0.2" has incorrect peer dependency "webpack@^4.0.0 || ^5.0.0".

warning " > eslint-plugin-react@6.10.3" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".

warning " > postcss-cssnext@2.11.0" has unmet peer dependency "caniuse-db@^1.0.30000652".

error An unexpected error occurred: "EPERM: operation not permitted, symlink '../../../parser/bin/babel-parser.js' -> '/data/code/java/metabase-master/node_modules/@babel/core/node_modules/.bin/parser'".

info If you think this is a bug, please open a bug report with the information provided in "/data/code/java/metabase-master/yarn-error.log".

info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

刚开始以为是babel包没有下载成功导致的,尝试删除依赖重新执行了几次依然不见好转,再仔细检查错误信息,考虑到时创建软链接时出现了问题,直接在命令行中手动创建一个软链接测试:

tianlang@tianlang-VirtualBox:/data/code/java/master$ ln -s yarn-error.log error.log

ln: failed to create symbolic link 'error.log': Operation not permitted        

还真是没权限创建软链接,考虑到使用的是Vbox虚拟机,就搜索了下Vbox开启使用软链接的配置:

执行命令前先关闭虚拟机

D:\Program Files\Oracle\VirtualBox>VBoxManage setextradata "elementary" VBoxInternal2/SharedFoldersEnableSymlinksCreate/code 1

其中`elementary`是虚拟机名称,`code`是共享文件夹名称,具体使用方式可以参考:

https://www.cnblogs.com/cxbhakim/p/8882947.html

执行成功后正常启动虚拟机,再次执行创建软链接的命令:

tianlang@tianlang-VirtualBox:/data/code/java/master$ ln -s yarn-error.log error.log

ln: failed to create symbolic link 'error.log': Protocol error   

虽然还是没有成功但报错信息不一样了,看来设置已经起作用了,接下来关闭虚拟机,关闭VboxManager, 然后以管理员身份运行VboxManager

再启动虚拟机,执行创建软链接命令,成功创建软链接。

再次执行yarn,也能成功执行了.

在使用cargo编译运行Rust项目tensorbase时也遇到了类似的问题:

Makefile:420: recipe for target 'lib/libjemalloc.so' failed

  --- stderr
  ln: failed to create symbolic link 'lib/libjemalloc.so': Protocol error
  make: *** [lib/libjemalloc.so] Error 1
  thread 'main' panicked at 'command did not execute successfully: "make" "-j" "1"
  expected success, got: exit status: 2', /home/tianlang/.cargo/registry/src/github.com-1ecc6299db9ec823/tikv-jemalloc-sys-0.4.1+5.2.1-patched/build.rs:333:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

使用同样的方式解决了.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一个不安分的程序员

祝您财源广进

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值