在Windows 10 Bash上安装webpack(在Windows上的Ubuntu上安装Bash).继续获取"webpack:找不到命令"; [英] Installing webpack on Windows 10 Bash (Bash on Ubuntu on Windows). Keep getting "webpack: command not found"

查看:56
本文介绍了在Windows 10 Bash上安装webpack(在Windows上的Ubuntu上安装Bash).继续获取"webpack:找不到命令";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过

I'm working my way through this React/Redux tutorial and I need to install webpack. I'm working on the Windows 10 bash shell. Here's the npm command I use to install and the installation output:

~$ npm install --save-dev webpack webpack-dev-server
voting-client@1.0.0 /home/username/voting-client
+-- webpack@1.14.0
¦ +-- acorn@3.3.0
¦ +-- async@1.5.2
¦ +-- clone@1.0.2
¦ +-- enhanced-resolve@0.9.1
¦ ¦ +-- graceful-fs@4.1.11
¦ ¦ +-- memory-fs@0.2.0
¦ +-- interpret@0.6.6
¦ +-- loader-utils@0.2.16
¦ ¦ +-- big.js@3.1.3
¦ ¦ +-- emojis-list@2.1.0
¦ ¦ +-- json5@0.5.1
¦ ¦ +-- object-assign@4.1.0
¦ +-- memory-fs@0.3.0
¦ ¦ +-- errno@0.1.4
¦ ¦ ¦ +-- prr@0.0.0
¦ ¦ +-- readable-stream@2.2.2
¦ ¦   +-- buffer-shims@1.0.0
¦ ¦   +-- core-util-is@1.0.2
¦ ¦   +-- isarray@1.0.0
¦ ¦   +-- process-nextick-args@1.0.7
¦ ¦   +-- util-deprecate@1.0.2
¦ +-- mkdirp@0.5.1
¦ ¦ +-- minimist@0.0.8
¦ +-- node-libs-browser@0.7.0
¦ ¦ +-- assert@1.4.1
¦ ¦ +-- browserify-zlib@0.1.4
¦ ¦ ¦ +-- pako@0.2.9
¦ ¦ +-- buffer@4.9.1
¦ ¦ ¦ +-- base64-js@1.2.0
¦ ¦ ¦ +-- ieee754@1.1.8
¦ ¦ +-- console-browserify@1.1.0
¦ ¦ ¦ +-- date-now@0.1.4
¦ ¦ +-- constants-browserify@1.0.0
¦ ¦ +-- crypto-browserify@3.3.0
¦ ¦ ¦ +-- browserify-aes@0.4.0
¦ ¦ ¦ +-- pbkdf2-compat@2.0.1
¦ ¦ ¦ +-- ripemd160@0.2.0
¦ ¦ ¦ +-- sha.js@2.2.6
¦ ¦ +-- domain-browser@1.1.7
¦ ¦ +-- events@1.1.1
¦ ¦ +-- https-browserify@0.0.1
¦ ¦ +-- os-browserify@0.2.1
¦ ¦ +-- path-browserify@0.0.0
¦ ¦ +-- process@0.11.9
¦ ¦ +-- punycode@1.4.1
¦ ¦ +-- querystring-es3@0.2.1
¦ ¦ +-- stream-browserify@2.0.1
¦ ¦ +-- stream-http@2.5.0
¦ ¦ ¦ +-- builtin-status-codes@2.0.0
¦ ¦ ¦ +-- to-arraybuffer@1.0.1
¦ ¦ ¦ +-- xtend@4.0.1
¦ ¦ +-- string_decoder@0.10.31
¦ ¦ +-- timers-browserify@2.0.2
¦ ¦ ¦ +-- setimmediate@1.0.5
¦ ¦ +-- tty-browserify@0.0.0
¦ ¦ +-- url@0.11.0
¦ ¦ ¦ +-- punycode@1.3.2
¦ ¦ ¦ +-- querystring@0.2.0
¦ ¦ +-- util@0.10.3
¦ ¦ ¦ +-- inherits@2.0.1
¦ ¦ +-- vm-browserify@0.0.4
¦ ¦   +-- indexof@0.0.1
¦ +-- optimist@0.6.1
¦ ¦ +-- wordwrap@0.0.3
¦ +-- supports-color@3.1.2
¦ ¦ +-- has-flag@1.0.0
¦ +-- tapable@0.1.10
¦ +-- uglify-js@2.7.5
¦ ¦ +-- async@0.2.10
¦ ¦ +-- source-map@0.5.6
¦ ¦ +-- uglify-to-browserify@1.0.2
¦ ¦ +-- yargs@3.10.0
¦ ¦   +-- camelcase@1.2.1
¦ ¦   +-- cliui@2.1.0
¦ ¦   ¦ +-- center-align@0.1.3
¦ ¦   ¦ ¦ +-- align-text@0.1.4
¦ ¦   ¦ ¦ ¦ +-- longest@1.0.1
¦ ¦   ¦ ¦ ¦ +-- repeat-string@1.6.1
¦ ¦   ¦ ¦ +-- lazy-cache@1.0.4
¦ ¦   ¦ +-- right-align@0.1.3
¦ ¦   ¦ +-- wordwrap@0.0.2
¦ ¦   +-- decamelize@1.2.0
¦ ¦   +-- window-size@0.1.0
¦ +-- watchpack@0.2.9
¦ ¦ +-- async@0.9.2
¦ ¦ +-- chokidar@1.6.1
¦ ¦   +-- anymatch@1.3.0
¦ ¦   ¦ +-- arrify@1.0.1
¦ ¦   +-- async-each@1.0.1
¦ ¦   +-- glob-parent@2.0.0
¦ ¦   +-- is-binary-path@1.0.1
¦ ¦   ¦ +-- binary-extensions@1.8.0
¦ ¦   +-- is-glob@2.0.1
¦ ¦   +-- readdirp@2.1.0
¦ ¦     +-- minimatch@3.0.3
¦ ¦     ¦ +-- brace-expansion@1.1.6
¦ ¦     ¦   +-- balanced-match@0.4.2
¦ ¦     ¦   +-- concat-map@0.0.1
¦ ¦     +-- set-immediate-shim@1.0.1
¦ +-- webpack-core@0.6.9
¦   +-- source-list-map@0.1.7
¦   +-- source-map@0.4.4
¦     +-- amdefine@1.0.1
+-- webpack-dev-server@1.16.2
  +-- compression@1.6.2
  ¦ +-- accepts@1.3.3
  ¦ ¦ +-- negotiator@0.6.1
  ¦ +-- bytes@2.3.0
  ¦ +-- compressible@2.0.9
  ¦ ¦ +-- mime-db@1.25.0
  ¦ +-- debug@2.2.0
  ¦ ¦ +-- ms@0.7.1
  ¦ +-- on-headers@1.0.1
  ¦ +-- vary@1.1.0
  +-- connect-history-api-fallback@1.3.0
  +-- express@4.14.0
  ¦ +-- array-flatten@1.1.1
  ¦ +-- content-disposition@0.5.1
  ¦ +-- content-type@1.0.2
  ¦ +-- cookie@0.3.1
  ¦ +-- cookie-signature@1.0.6
  ¦ +-- depd@1.1.0
  ¦ +-- encodeurl@1.0.1
  ¦ +-- escape-html@1.0.3
  ¦ +-- etag@1.7.0
  ¦ +-- finalhandler@0.5.0
  ¦ ¦ +-- statuses@1.3.1
  ¦ ¦ +-- unpipe@1.0.0
  ¦ +-- fresh@0.3.0
  ¦ +-- merge-descriptors@1.0.1
  ¦ +-- methods@1.1.2
  ¦ +-- on-finished@2.3.0
  ¦ ¦ +-- ee-first@1.1.1
  ¦ +-- parseurl@1.3.1
  ¦ +-- path-to-regexp@0.1.7
  ¦ +-- proxy-addr@1.1.2
  ¦ ¦ +-- forwarded@0.1.0
  ¦ ¦ +-- ipaddr.js@1.1.1
  ¦ +-- qs@6.2.0
  ¦ +-- range-parser@1.2.0
  ¦ +-- send@0.14.1
  ¦ ¦ +-- destroy@1.0.4
  ¦ +-- serve-static@1.11.1
  ¦ +-- type-is@1.6.14
  ¦ ¦ +-- media-typer@0.3.0
  ¦ +-- utils-merge@1.0.0
  +-- http-proxy-middleware@0.17.3
  ¦ +-- http-proxy@1.16.2
  ¦ ¦ +-- eventemitter3@1.2.0
  ¦ ¦ +-- requires-port@1.0.0
  ¦ +-- is-glob@3.1.0
  ¦ ¦ +-- is-extglob@2.1.1
  ¦ +-- lodash@4.17.2
  ¦ +-- micromatch@2.3.11
  ¦   +-- arr-diff@2.0.0
  ¦   ¦ +-- arr-flatten@1.0.1
  ¦   +-- array-unique@0.2.1
  ¦   +-- braces@1.8.5
  ¦   ¦ +-- expand-range@1.8.2
  ¦   ¦ ¦ +-- fill-range@2.2.3
  ¦   ¦ ¦   +-- is-number@2.1.0
  ¦   ¦ ¦   +-- isobject@2.1.0
  ¦   ¦ ¦   +-- randomatic@1.1.6
  ¦   ¦ +-- preserve@0.2.0
  ¦   ¦ +-- repeat-element@1.1.2
  ¦   +-- expand-brackets@0.1.5
  ¦   ¦ +-- is-posix-bracket@0.1.1
  ¦   +-- extglob@0.3.2
  ¦   +-- filename-regex@2.0.0
  ¦   +-- is-extglob@1.0.0
  ¦   +-- kind-of@3.1.0
  ¦   ¦ +-- is-buffer@1.1.4
  ¦   +-- normalize-path@2.0.1
  ¦   +-- object.omit@2.0.1
  ¦   ¦ +-- for-own@0.1.4
  ¦   ¦ ¦ +-- for-in@0.1.6
  ¦   ¦ +-- is-extendable@0.1.1
  ¦   +-- parse-glob@3.0.4
  ¦   ¦ +-- glob-base@0.3.0
  ¦   ¦ +-- is-dotfile@1.0.2
  ¦   +-- regex-cache@0.4.3
  ¦     +-- is-equal-shallow@0.1.3
  ¦     +-- is-primitive@2.0.0
  +-- open@0.0.5
  +-- serve-index@1.8.0
  ¦ +-- batch@0.5.3
  ¦ +-- http-errors@1.5.1
  ¦ ¦ +-- setprototypeof@1.0.2
  ¦ +-- mime-types@2.1.13
  +-- sockjs@0.3.18
  ¦ +-- faye-websocket@0.10.0
  ¦ ¦ +-- websocket-driver@0.6.5
  ¦ ¦   +-- websocket-extensions@0.1.1
  ¦ +-- uuid@2.0.3
  +-- sockjs-client@1.1.1
  ¦ +-- eventsource@0.1.6
  ¦ ¦ +-- original@1.0.0
  ¦ ¦   +-- url-parse@1.0.5
  ¦ +-- faye-websocket@0.11.0
  ¦ +-- inherits@2.0.3
  ¦ +-- json3@3.3.2
  ¦ +-- url-parse@1.1.7
  ¦   +-- querystringify@0.0.4
  +-- stream-cache@0.0.2
  +-- strip-ansi@3.0.1
  ¦ +-- ansi-regex@2.0.0
  +-- webpack-dev-middleware@1.9.0
    +-- memory-fs@0.4.1
    +-- mime@1.3.4
    +-- path-is-absolute@1.0.1

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.15

因此,除了两个警告外,它看起来像已安装,并且我认为我不需要fsevents.但是,当我尝试运行webpack时,它的行为就像未安装.

So besides the two warnings, it looks like it installs, and I don't think I needs fsevents. However, when I try to run webpack it acts like it's not installed.

~$ webpack
webpack: command not found

推荐答案

我认为这是Windows Bash shell的问题,但是我在Ubuntu VM上确认了同样的问题,并且做了更多的挖掘工作.以超级用户身份进行全局安装可以使其正常工作:

I thought this was an issue with the Windows Bash shell, but I confirmed the same problem on an Ubuntu VM and did some more digging. Installing globally as superuser got it working:

sudo npm install i -g --save-dev webpack webpack-dev-server

这篇关于在Windows 10 Bash上安装webpack(在Windows上的Ubuntu上安装Bash).继续获取"webpack:找不到命令";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆