2016-12-23 103 views
2

我正在通過這個React/Redux tutorial我的方式工作,我需要安裝webpack。我正在開發Windows 10 bash shell。下面是我用來安裝NPM命令和安裝的輸出:在Windows 10 Bash上安裝webpack(Windows上的Ubuntu上的Bash)。繼續收到「webpack:命令沒有找到」

~$ npm install --save-dev webpack webpack-dev-server 
[email protected] /home/username/voting-client 
+-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦ +-- [email protected] 
¦ ¦  +-- [email protected] 
¦ ¦  ¦ +-- [email protected] 
¦ ¦  ¦ +-- [email protected] 
¦ ¦  ¦ +-- [email protected] 
¦ ¦  +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦ +-- [email protected] 
¦  +-- [email protected] 
+-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ ¦ +-- [email protected] 
    ¦ ¦ ¦ +-- [email protected] 
    ¦ ¦ ¦ +-- [email protected] 
    ¦ ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦  +-- [email protected] 
    ¦  +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- websocke[email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 
    ¦ +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 
    +-- [email protected] 

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: 
npm WARN notsup Not compatible with your operating system or architecture: [email protected] 

因此,除了兩次警告的,它看起來像它安裝,我不認爲我需要fsevents。但是,當我嘗試運行webpack時,它的行爲就像沒有安裝。

~$ webpack 
webpack: command not found 

回答

1

我認爲這是Windows Bash shell的一個問題,但我在Ubuntu VM上確認了同樣的問題,並做了一些更多的挖掘。作爲全球超級用戶安裝了它的工作:

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

我有同樣的問題,當我安裝的WebPack是這樣的: 「命令NPM安裝--save-dev的的WebPack」把它扔到了我同樣的錯誤:「的WebPack:命令未找到「,我正在使用Ubuntu 16.04。 安裝它在全球範圍解決了這一問題:sudo的NPM安裝--save-dev的的WebPack -g「

0

TL;博士:儘量$ node_modules\.bin\webpack

我想,這是不是一個bash的問題,但對於節點對於一般的窗戶。(和任何包CLI) (這是因爲我有這樣的任何殼)爲了解決這個檢查幾點:

  1. 確保您已的WebPack安裝:檢查node_modules\.bin\webpack.cmd在項目文件夾。它應該存在。(note:如果你intal用-g引導它你需要檢查它在...NodeJS\core\node_modules_global\
  2. 你如何開始你的shell使用Node?在NodeJS\core中有一個nodevars.bat,你需要在使用Node之前每次運行設置一些環境(對不起,我不熟悉你的bash shell,所以你需要找到你的方式來預先運行這個bat文件)
  3. 最後,您需要確保您的Path中有node_modules\.bin,這是您看到webpack: command not found的主要原因。只需將此路徑(相對於node_modules\.bin或絕對D:\your_project_path\node_modules\.bin)添加到您的Path變種。 (或嘗試運行它通過node_modules\.bin\webpack.com
相關問題