homestead虚拟机,通过npm下载依赖包和解决运行gulp报错问题 yarn出错问题

homestead虚拟机,通过npm下载依赖包和解决运行gulp报错问题 yarn出错问题

1. 在虚拟器运行 npm 下载依赖组件时报错:

npm ERR! EPROTO: protocol error, symlink ...

解决方案:

运行 npm 时增加参数 --no-bin-links 

npm install --no-bin-links

 

2. 执行 gulp 命令时报错:

ENOENT: no such file or directory, scandir '/home/vagrant/Code/sample/node_modules/node-sass/vendor'

解决方案:

使用 npm 重新生成 node-saaa

npm rebuild node-sass --no-bin-links

 

windows host中的vagrant box Linux中使用npm install时,由于host os不支持linuxsymbol link,所以必须使用 --no-bin-links 命令

 

加速 npm 下载速度

npm config set registry http://registry.npm.taobao.org

 

yarn install 报错

error An unexpected error occurred: "EPROTO: protocol error, symlink '../../

  1. 删除应用里面的 node_modules 文件夹。

    rm –rf node_modules

yarn install --save --no-bin-links

 

  1. 配置淘宝 npm 镜像。

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm 重新安装。

$ cnpm install

等待安装完成。

$ downloading

进入应用根目录 (我的是 sample ) ,启动 gulp

$ gulp

如果出现以下界面,那就是成功了

 

[15:43:28] Using gulpfile ~/Code/sample/gulpfile.js

[15:43:28] Starting 'default'...

[15:43:28] Starting 'sass'...

 

Fetching Sass Source Files...

- resources/assets/sass/app.scss

 

Saving To...

 

 

原文地址:https://www.cnblogs.com/lovebing/p/7115585.html