npm run watch-poll

使用 webpack 自动编译时,出现异常,日志:

[root@vm shop]# npm run watch-poll

> @ watch-poll /home/www/shop
> npm run watch -- --watch-poll


> @ watch /home/www/shop
> npm run development -- --watch "--watch-poll"


> @ development /home/www/shop
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"

sh: cross-env: command not found

npm ERR! Linux 3.10.0-229.20.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "development" "--" "--watch" "--watch-poll"
npm ERR! node v6.16.0
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
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" "--watch-poll"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"'.
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!     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /home/www/shop/npm-debug.log

npm ERR! Linux 3.10.0-229.20.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "watch" "--" "--watch-poll"
npm ERR! node v6.16.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ watch: `npm run development -- --watch "--watch-poll"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script 'npm run development -- --watch "--watch-poll"'.
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!     npm run development -- --watch "--watch-poll"
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /home/www/shop/npm-debug.log

npm ERR! Linux 3.10.0-229.20.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "watch-poll"
npm ERR! node v6.16.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch-poll script 'npm run watch -- --watch-poll'.
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!     npm run watch -- --watch-poll
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /home/www/shop/npm-debug.log
[root@vm shop]#

配置 Yarn 安装加速:yarn config set registry https://registry.npm.taobao.org
使用 Yarn 安装依赖:SASS_BINARY_SITE=http://npm.taobao.org/mirrors/node-sass yarn
yarn 前指定 SASS_BINARY_SITE 的上的是告诉 yarn 到淘宝的镜像下载 node-sass 二进制文件。
然后再次执行 npm run watch-poll

[root@vm shop]# yarn config set registry https://registry.npm.taobao.org
yarn config v1.15.2
success Set "registry" to "https://registry.npm.taobao.org".
Done in 0.06s.
[root@vm shop]#
[root@vm shop]# SASS_BINARY_SITE=http://npm.taobao.org/mirrors/node-sass yarn
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 30.13s.
[root@vm shop]#
[root@vm shop]# npm run watch-poll

> @ watch-poll /home/www/shop
> npm run watch -- --watch-poll


> @ watch /home/www/shop
> npm run development -- --watch "--watch-poll"


> @ development /home/www/shop
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"

 	Additional dependencies must be installed. This will only take a moment.

 	Running: yarn add vue-template-compiler --dev --production=false

warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
 	Okay, done. The following packages have been installed and saved to your package.json dependencies list:

 	- vue-template-compiler

 10% building 1/1 modules 0 active
webpack is watching the files…

 98% after emitting SizeLimitsPlugin

 DONE  Compiled successfully in 9795ms                                                                        8:58:06 AM

       Asset      Size   Chunks             Chunk Names
/css/app.css   174 KiB  /js/app  [emitted]  /js/app
  /js/app.js  1.37 MiB  /js/app  [emitted]  /js/app

猜你喜欢

转载自blog.csdn.net/u013239054/article/details/88987513