laravel npm:缺少laravel-mix 目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52120914/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:01:17  来源:igfitidea点击:

npm: laravel-mix directory missing

laravellaravel-mix

提问by Faramarz

I'm trying to run npm run devon a Laravel project, but i get the following error:

我正在尝试npm run dev在 Laravel 项目上运行,但出现以下错误:

Error: Cannot find module '/home/faramarz/todo/node_modules/laravel-mix/setup/     
webpack.config.js'    

and yes , there is no such file in the node-module dir. but i ran npm installwith no problem.
i also ran npm i laravel-mixbut it didn't install it.

是的,节点模块目录中没有这样的文件。但我跑npm install了没问题。
我也跑了,npm i laravel-mix但是没有安装。

this is my package.json:

这是我的 package.json:

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env 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": "cross-env 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": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
    "axios": "^0.17",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.2.0",
    "jquery": "^3.2",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.4",
    "vue": "^2.5.7"
}

}

}

i always face this problem running this command.any help?

我在运行这个命令时总是遇到这个问题。有什么帮助吗?

npm -v:6.4.1

npm -v:6.4.1

回答by Polaris

Delete node_module directory and run

删除 node_module 目录并运行

    rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

in command line

在命令行中

If that doesn't work, try

如果这不起作用,请尝试

npm install webpack --save