node.js - 为什么“npm run watch”在 laravel 中会出错?
问题描述
我正在关注本教程http://w3programmers.com/bangla/build-an-e-commerce-project-with-laravel-in-bangla-part-6/。在本教程中,当在命令提示符下执行“npm run watch”时,会在 public/backend/js 中创建一个 app.js 文件。但是当我执行“npm run watch”时,没有创建这样的文件。执行“npm run watch”命令后,我在命令提示符中找到了这个
> @ watch E:\Laravel\ecommerce-application
> npm run development -- --watch
> @ development E:\Laravel\ecommerce-application
> 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"
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'E:\Laravel\ecommerce-application\node_modules\cross-env\dist\bin\cross-env.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `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"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\J.U.Jisan\AppData\Roaming\npm-cache\_logs\2020-05-09T18_22_08_016Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\J.U.Jisan\AppData\Roaming\npm-cache\_logs\2020-05-09T18_22_08_158Z-debug.log
解决方案
运行这两条线,它们为我工作。
$ npm config rm proxy
$ npm config rm https-proxy
然后,去听你的命令。
推荐阅读
- excel - Excel / Google Sheets 按产品和月份计算的产品数量总和
- python - 关于 Python 的内置类型是可迭代对象的问题
- java - 使用 yGuard 混淆胖 jar(maven 项目)中的特定包
- scala - 如何在 Scala 中将列表用作堆栈
- sql - 在 Oracle DB 中上传/存储大 CSV 文件并在后续上传时更新文件
- javascript - 关于使用 Array.push() 合并数组的问题;
- mysql - AzerothCore登录突然想要验证码
- flutter - 像 FlateButton Flutter 一样修改 ElevateButton
- flutter - 在 null 上调用 getter 'length' 导致错误屏幕
- tableau-api - Oracle ATP 连接失败并出现错误代码:7EF979EO