[windows] install cross-env with cnpm instead of yarn or npm
环境是 windows下通过vagrant运行虚拟机(ubuntu)
Host:windows 10
Guest: ubuntu(vagrant)
根据之前的经验,不要在 Guest环境中执行npm install操作
大坑:虚拟机共享目录中不要进行任何的开发工作
所以在 Host环境中安装
1 ganik@ddhc MINGW64 /d/Code/go-laravel/weibo (filling-layout-style) 2 $ yarn add cross-env --no-bin-links 3 yarn add v1.16.0 4 [1/4] Resolving packages... 5 [2/4] Fetching packages... 6 info fsevents@1.2.9: The platform "win32" is incompatible with this module. 7 info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. 8 [3/4] Linking dependencies... 9 warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0". 10 [4/4] Building fresh packages... 11 12 warning "cross-env" is already in "devDependencies". Please remove existing entry first before adding it to "dependencies". 13 success Saved 1 new dependency. 14 info Direct dependencies 15 └─ cross-env@5.2.0 16 info All dependencies 17 └─ cross-env@5.2.0 18 Done in 5.07s.
看似安装好了,其实上面是有警告的,cross-env也并没有成功安装
1 ganik@ddhc MINGW64 /d/Code/go-laravel/weibo (filling-layout-style) 2 $ npm run dev 3 4 > @ dev D:\Code\go-laravel\weibo 5 > npm run development 6 7 8 > @ development D:\Code\go-laravel\weibo 9 > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 10 11 'cross-env' not found
安装 cnpm
1 ganik@ddhc MINGW64 /d/Code/go-laravel/weibo (filling-layout-style) 2 $ npm install -g cnpm --registry=https://registry.npm.taobao.org 3 4 C:\Users\ganik\AppData\Roaming\npm\cnpm -> C:\Users\ganik\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm 5 + cnpm@6.1.0 6 added 683 packages from 900 contributors in 49.846s
用 cnpm 安装 cross-env
1 ganik@ddhc MINGW64 /d/Code/go-laravel/weibo (filling-layout-style) 2 $ cnpm install cross-env --no-bin-links 3 √ Installed 1 packages 4 √ Linked 9 latest versions 5 √ Run 0 scripts 6 √ All packages installed (10 packages installed from npm registry, used 1s(network 1s), speed 56.17kB/s, json 10(17.42kB), tarball 50.32kB)
cross-env 正常运行了
1 ganik@ddhc MINGW64 /d/Code/go-laravel/weibo (filling-layout-style) 2 $ npm run dev 3 4 > @ dev D:\Code\go-laravel\weibo 5 > npm run development 6 7 8 > @ development D:\Code\go-laravel\weibo 9 > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 10 11
作者:ganiks
出处:http://www.cnblogs.com/ganiks/
本作品由 Ganiks 创作, 欢迎转载,但任何转载必须保留完整文章,在显要地方显示署名以及原文链接。如您有任何疑问,请给我留言。
出处:http://www.cnblogs.com/ganiks/
本作品由 Ganiks 创作, 欢迎转载,但任何转载必须保留完整文章,在显要地方显示署名以及原文链接。如您有任何疑问,请给我留言。