I am trying to compile webpack configuration files with Laravel Mix.

Following webpack episode on Laracasts Vue 2 series,

// Scripts

  "scripts": {
    "dev": "node node_modules/cross-env/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"
  },
....

// mix
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version();

When I run $ npm run dev, I get an error:

npm ERR! Exit status 1

npm ERR! Failed at the @ dev script 'node node_modules/cross-env/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'.

// Running

npm ERR! node v4.4.5
npm ERR! npm v2.15.5

// The error points to
let extractPlugin = new plugins.ExtractTextPlugin(
/Users/User/Code/project/node_modules/laravel-mix/setup/webpack.config.js:126

The issue seems to be update a Node.js dependency: https://github.com/JeffreyWay/laravel-mix/issues/264

How do I update the Node.js dependency?

I am trying:

$ brew upgrade node : Error = node not installed
$ node -v = 2.15.5
$ npm -v = 4.4.5
$ brew install node // installs but throws error

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
  rm '/usr/local/bin/node'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

要列出将被删除的所有文件,请执行以下操作:
  brew link --overwrite --dry-run node

Possible conflicting files are:
/usr/local/bin/node
...

**$ brew upgrade node // says node 7.5.0 already installed**
$ npm run dev // same error
$ node -v = 4.4.5

我还运行了已安装的$BREW安装 node ,但收到错误:

Error: The brew link step did not complete successfully.
The formula built, but is not symlinked into /usr/local.
Could not symlink bin/node.
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'

To force the link and overwrite all conflicting files:

brew link --overwrite node

要列出将被删除的所有文件,请执行以下操作:

brew link --overwrite --dry-run node

推荐答案

我安装了Node.再次来自nodejs.org,重写旧文件.

然而,这实际上将npm从4.4.5降到了4.1.2... node .js是2.15.5,现在是7.5.0.

我还必须安装几个模块:$ npm install autoprefixer

$ npm run dev // works now

Laravel相关问答推荐

Laravel 语法 GroupBy 获取列到数组

如何传递多个参数给路由

Laravel:在行的子集上同步多对多

如何在 Laravel 中使用 Vue 路由?

如何在 laravel 5.3 中验证没有 auth:api 中间件的用户?

如何在 Laravel 中显示渲染时间/页面加载时间?

Laravel 5.1 是否与 PHP 7 兼容

从 sqlite DB 登录 Laravel,得到PDOException 找不到驱动程序

如何在新安装时指定 Lumen(或 Laravel)版本?

如何更改 ember-cli 中的 dist 文件夹路径?

Laravel 随机排序

Laravel 5 Mime 验证

Laravel 中的单会话登录

Composer RuntimeException - 无法加载软件包 mews/purifier

assets资源不引用公用文件夹(Laravel)

控制器中的laravel foreach循环

Mac OS X 需要 Mcrypt PHP 扩展

如何以及在哪里可以使用 laravel 存储图像?

Laravel Route 模型与关系绑定

有没有办法让表名自动添加到 Eloquent 查询方法中?