webpack 安裝報(bào)錯
- node.js 安裝 官網(wǎng)下載安裝即可 https://nodejs.org/en/
- webpack 安裝
sudo npm install webpack -g
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.9 and node@11.14.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/webpack/node_modules/fsevents/build'
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /usr/local/lib/node_modules/webpack/node_modules/fsevents
gyp ERR! node -v v11.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
解決辦法
sudo npm install webpack -g
或
sudo npm install webpack -g --unsafe-perm=true --allow-root
(我用的此方法)
或
sudo npm install webpack -g --unsafe-perm=true
-
這時(shí)終端輸入
webpack -v
可能會提示 webpack-cli沒有安裝耍缴,如下圖
如果直接使用yes 或npm install -D 或 sudo npm install -D 都有可能報(bào)錯
此時(shí)試試sudo npm install webpack-cli -g
再次檢查就可以webpack -v
vue -cli 安裝
sudo npm install vue-cli -g
項(xiàng)目啟動時(shí)報(bào)錯
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
翻譯過來就是: 'webpack-dev-server' 不是內(nèi)部或外部命令罪裹,也不是可運(yùn)行的程序
很可能是項(xiàng)目 install
時(shí)不完全造成的焰轻, 可以使用cnpm install
境內(nèi)安裝
項(xiàng)目初始化時(shí)最后會讓你選擇是否install和install途徑, 最好是選擇稍后手動安裝cnpm install
sh: webpack-dev-server: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
剛拿到項(xiàng)目時(shí)愈涩, npm start 或npm run dev 包這個錯 先執(zhí)行cnpm install 安裝依賴文件
- cnpm: command not found 切換到淘寶鏡像
npm install -g cnpm --registry=https://registry.npm.taobao.org
項(xiàng)目初始化
-
在你要創(chuàng)建項(xiàng)目的文件夾下 vue init webpack '文件名', 然后依次錄入 項(xiàng)目名慢显、項(xiàng)目描述
都是圖究抓、都是圖 ??????????
項(xiàng)目初始化參考:
http://www.reibang.com/p/1626b8643676