Laravel:npm run watch错误

时间:2017-03-20 13:18:19

标签: node.js laravel npm

我正在开展一个项目,我正在运行  npm run watch' 我收到了这个错误。我工作正常,但突然间我得到了这个错误!

> @ 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

我该怎么办?

3 个答案:

答案 0 :(得分:1)

  

如果您在Windows系统上进行开发或者在Windows主机系统上运行VM,则可能需要在启用了--no-bin-links开关的情况下运行npm install命令:

使用此命令安装:

npm install --no-bin-links

然后运行:

npm run watch-poll

Source for 5.4

Source for <= 5.3

答案 1 :(得分:0)

我只是简单地删除了构建的CSS和JS文件以及mix-manifest.json文件。之后事情有效

答案 2 :(得分:0)

注意:确保安装了最新版本的node.js和npm。

  • 清除NPM的缓存: sudo npm cache clean -f
  • 安装called 'n'sudo npm install -g n
  • 安装最新的稳定Node.js版本:sudo n stable

或者选择特定版本并安装如下:

sudo n (wanted node version)

您可以通过以下方式获取有关如何为此项目打开问题的信息:npm bugs

它在日志输出中逐字描述了要做什么......

相关问题