gpt4 book ai didi

node.js - Laravel Mix : Update a Node. js 依赖

转载 作者:IT老高 更新时间:2023-10-28 23:22:16 24 4
gpt4 key购买 nike

我正在尝试使用 Laravel Mix 编译 webpack 配置文件。

在 Laracasts Vue 2 系列的 webpack 插曲之后,

// 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();

当我运行 $ npm run dev 时,我得到一个错误:

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

问题似乎是更新 Node.js 依赖项:https://github.com/JeffreyWay/laravel-mix/issues/264

如何更新 Node.js 依赖项?

我正在尝试:

$ 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

To list all files that would be deleted:
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 install 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'

强制链接并覆盖所有冲突文件:

brew link --overwrite node

列出所有将被删除的文件:

brew link --overwrite --dry-run node

最佳答案

您可以删除 laravel 项目中的 Node 模块文件夹。

之后运行:

npm install - g npm

此命令将使用升级 Node 文件重新安装 Node 模块文件夹。接下来,您可以尝试运行

npm run dev

你也可以运行

npm update

更新你的 Node

希望这个答案会有所帮助

关于node.js - Laravel Mix : Update a Node. js 依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42068686/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com