0
我正在一個laravel項目,並試圖添加一些較少的樣式表。nam運行*更新webpack.mix.ks後不工作
然而,當我改變webpack.min.js從這個:
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|------------------------------------------------------------------------- -
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
到:
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|------------------------------------------------------------------------- -
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
mix.less('resources/assets/less/main.less', 'public/css');
我NPM停止工作。當我嘗試這些變化,我得到以下錯誤後執行NPM運行開發:
> @ dev /Applications/MAMP/htdocs/***.dev
> npm run development
> @ development /Applications/MAMP/htdocs/***.dev
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Additional dependencies must be installed. This will only take a moment.
/bin/sh: yarn: command not found
child_process.js:515
throw err;
^
Error: Command failed: yarn add less-loader less --save
/bin/sh: yarn: command not found
at checkExecSyncError (child_process.js:472:13)
at execSync (child_process.js:512:13)
at installDependencies (/Applications/MAMP/htdocs/***.dev/node_modules/laravel-mix/src/Verify.js:127:5)
at Function.dependency (/Applications/MAMP/htdocs/***.dev/node_modules/laravel-mix/src/Verify.js:103:13)
at Api.less (/Applications/MAMP/htdocs/***.dev/node_modules/laravel-mix/src/Api.js:113:16)
at Object.<anonymous> (/Applications/MAMP/htdocs/***.dev/webpack.mix.js:16:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "development"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Applications/MAMP/htdocs/***.dev/npm-debug.log
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script 'npm run development'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Applications/MAMP/htdocs/***.dev/npm-debug.log
我不知道是什麼問題,並且已經嘗試重新安裝NPM和laravel組合。也被清除NPM緩存..
仍在運行在此之後,同樣的問題.. –
你在運行它之後的故事嗎? – fppz
你有沒有設置npm全局運行?你也可以嘗試「npm安裝紗 - 保存」 – fppz