我正在尝试运行 npm run watch 以实现我在资产文件中执行的更改,但它不起作用。我正在创建一个 laravel 工具。
我已经安装了 npm,没有任何错误,但是当我运行 npm run watch 时,出现了以下错误。谢谢你的帮助。
> npm run development -- --watch
> @ development C:\Users\\Documents\tool
> 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' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
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 "--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 ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2019-08-13T08_58_29_406Z-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 ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2019-08-13T08_58_29_436Z-debug.log
答案1
你缺少corss-env
节点模块
尝试关注
node_modules
从项目中删除文件夹- 运行此命令
npm install --global cross-env
。 "cross-env": "^5.0.1"
从package.json
文件 devDependencies 部分删除。- 跑步
npm install --no-bin-links
- 现在
run npm run dev