Vue.js 雜記



如題,雜記。


1、在 WebStorm 中創建新項目,運行命令 cnpm install 出現以下錯誤。

20 error code ELIFECYCLE
21 error errno 1
22 error fcp_demo_v1@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the fcp_demo_v1@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]


方法一:根據網上搜索的結果,刪除目錄 node_modules,重新執行 cnpm install。

這個方法有時候可行。

方法二:打開 Windows 自帶的命令提示符,進入項目所在目錄,執行 cnpm install,顯示如下文字,表示安裝完成。

D:\workspace-webstorm\fcp_demo_v1>cnpm install
√ Installed 58 packages
√ Linked 0 latest versions
√ Run 0 scripts
√ All packages installed (used 63ms(network 57ms), speed 0B/s, json 0(0B), tarball 0B)

方法三:執行以下命令。

npm install -g vue-cli

 

2、使用 VS Code 支持開發 Vue.js。

輸入以下命令,安裝插件 vetur。

ext install vetur


3、Vue.js 開發項目,構建時報錯。

  • 如下錯誤:
UnSupportedPlatformError: Package require os(linux) not compatible with your platform(win32)

執行如下命令。

npm install


  • 如下錯誤:
npm ERR! Maximum call stack size exceeded

據說是npm版本問題,升級或回退即可,但是在下沒有處理,只是重新執行了一次。


  • 如下錯誤:
'*' 不是內部或外部命令,也不是可運行的程序

安裝相應的依賴。


  • 如下錯誤:
Trailing spaces not allowed

末尾不允許有空格。


4、運行項目 debug 時,出現 SCRIPT5022: SecurityError 錯誤。具體如下:

SCRIPT5022: SecurityError
sockjs.js (1683,3)
Invalid Host/Origin header
[WDS] Disconnected!

可能出現的原因是,IE 11重復創建了 WebSocket連接

解決方案:關掉頁面,重新打開就可以了。或者參考下面的鏈接修改注冊表。

參考鏈接:https://blog.csdn.net/lyn1772671980/article/details/81985335

待續。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM