最近有時間執返好D code 開始set 返好D ESLint 發現 update 左 eslint config後.. 有很多files 要fix 如果有command / function 可以一次過scan and fix 曬便好 解決方法 我們只需要在 CLI 上執行這個 eslint command 便可 npx eslint --fix --ext .js . 同埋可以在 package.json 的 script 上加多一個command 就會更放便
2023-02-08
最近想 Upgrade 現有的 NextJs Project 所以諗住用 npx create-next-app@latest 來建立一個新的 project 來做 migration 問題出現了… NextJs 的 default port 是 3000 那麼怎樣可以更改其中一個project 的 starting port 呢? 解決方法 我們只需要更新 package.json 上的 dev script 加 -p [PORT_NUMBER] 便可
2023-02-05
嘗試起個新既 NodeJs project 用 import rather than require 時出現以下 Exception.. SyntaxError: Cannot use import statement outside a module 解決方法: 原來只要係 package.json 上 加返以下 property 便可.. "type": "module", hope you find it useful
2023-02-03
今日係 NodeJs 上用 Jest 寫 Unit Test 時出現了以下錯誤信息 ReferenceError: regeneratorRuntime is not defined ReferenceError: regeneratorRuntime is not defined 解決方法: 只要在 NodeJs Project 上安裝 babel-polyfill package 之後在 Unit Test file 上 import babel-polyfill 便可 e.g.
2020-07-25
今日有個 task 其中一個地方要在 Array of Json object 中 Distinct 一個 property const data = [ { id: 1, category: 'fruit', name: 'Apple', }, { id: 2, category: 'fruit', name: 'Banana', }, { id: 3, category: 'herb', name: 'Basil', }, { id: 4, category: 'herb', name: 'Rosemary', }, { id: 5, category: 'fruit', name: 'Dragon Fruit', }, ]; 解決方法: (ES5)
2019-06-25
使用 firebase hosting 來 host reactjs 既時候 出現了以下問題 當我直接在 browser 輸入 ReactJs 的 route 既時候 出現了 Page Not Found This file does not exist and there was no index.html found in the current directory or 404.html in the root directory firebase page not found
2019-06-25
今日嘗試在RaspberryPi上安裝Johnny-Five /CylonJs 時出現NodeJs 的版本問題 但是執行 sudo apt-get install node 他說 NodeJs已經安裝了 做了一會 research 之後 發現我們可以使用以下方法來更新這個NodeJs的 解決方法 我𠍒可以在Terminal 上執行以下command NodeJs 6.x curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs NodeJs 7.x
2017-05-23