MENU

Laravel踩坑日记:解决:NPM ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js

node使用淘宝源:npm config set registry https://registry.npm.taobao.org

安装laravel min遇到两个问题,一个是sass报错,一个是cross-env报错,

sass报错解决办法:使用cnpm,npm install -g cnpm --registry=https://registry.npm.taobao.org

cross-env报错解决办法:修改根目录下的package.json文件的script内容为:

 "dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"

转至:laravel-China

Archives QR Code
QR Code for this page
Tipping QR Code