[英]Laravel: npm run watch Error
I was working on a project and I run 'npm run watch' and I got this error.我正在做一个项目,运行“npm run watch”时出现了这个错误。 I was working normally but all of sudden I got this error!
我工作正常,但突然间我收到了这个错误!
> @ watch C:\projects\tests\blog
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development
node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js
undefined:1
SyntaxError: Unexpected token
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe"
"C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
npm ERR! node v6.10.0
npm ERR! npm v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `node node_modules/cross-env/dist/bin/cross-env.js
NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script 'node node_modules/cross- env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --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! node node_modules/cross-env/dist/bin/cross-env.js
NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --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! C:\Users\Bruno\AppData\Roaming\npm-cache\_logs\2017-03-20T13_06_27_111Z-debug.log
What should I do?我应该怎么办?
If you are developing on a Windows system or you are running your VM on a Windows host system, you may need to run the npm install command with the --no-bin-links switch enabled:
如果您在 Windows 系统上开发或在 Windows 主机系统上运行 VM,您可能需要运行 npm 安装命令并启用 --no-bin-links 开关:
Install using this command:使用此命令安装:
npm install --no-bin-links
And run this after:然后运行这个:
npm run watch-poll
I just simply deleted built CSS and JS files as well as the mix-manifest.json
file.我只是简单地删除了构建的 CSS 和 JS 文件以及
mix-manifest.json
文件。 Things worked afterwards事情后来奏效了
For me just deleted the mix-manifest.json
file.对我来说,刚刚删除了
mix-manifest.json
文件。 Then did npm run watch-poll
然后
npm run watch-poll
My package.json
script.我的
package.json
脚本。
"scripts": {
"dev": "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": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
Running laravel from xampp shell (windows 7)从 xampp 运行 laravel shell (windows 7)
Note: Make sure you have the latest version of node.js and npm installed.注意:确保安装了最新版本的 node.js 和 npm。
sudo npm cache clean -f
sudo npm cache clean -f
sudo npm install -gn
sudo npm install -gn
sudo n stable
sudo n stable
Alternatively pick a specific version and install like this:或者选择一个特定版本并像这样安装:
sudo n (wanted node version)
You can get information on how to open an issue for this project with: npm bugs
您可以获得有关如何为该项目打开问题的信息:
npm bugs
It's literally described in the log output what to do...它在日志 output 中逐字描述了要做什么......
try this also: npm uninstall --save-dev sass-loader也试试这个:npm uninstall --save-dev sass-loader
It just ran perfectly when i tried to run the command npm run dev / npm run watch当我尝试运行命令 npm run dev / npm run watch 时,它运行完美
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.