1. 由于众所周知的原因,添加淘宝镜像
$ yarn config set registry https://registry.npm.taobao.org
2. 通过使用yarn安装npm依赖
$ yarn install --no-bin-links (win环境下 必须添加 --no-bin-links)
为防止报错,删除
cross-env
找到pakage.json
"scripts": {
"dev": "npm run development",
"development": " NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": " NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
3. 运行
$ npm run watch-poll
4. 其他
报错 删除
node_modules
$ rm -rf node_modules
参考:npm报错