//tips
//smart contract
Vercelの下記に関する読み込みエラーについて調べていく。
./pages/ID/[id]/edit.js
Error: React Hook "useRouter" is called in function "edit" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
Error: React Hook "useRef" is called in function "edit" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
Error: React Hook "useState" is called in function "edit" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
Error: React Hook "useStyles" is called in function "edit" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
useSWRの使用に全て変えなければいけないかとドキドキしていたが、関数名の 1 文字目を大文字にすれば良いとのこと。
https://qiita.com/yamashin0616/items/43102dd617e2e0358183
https://stackoverflow.com/questions/30373343/reactjs-component-names-must-begin-with-capital-letters#:~:text=React%20recommend%20naming%20components%20with,before%20using%20it%20in%20JSX%20.
EditをEditに変更。無事にこの問題は解決した。
Githubに再度新たなレポジトリを作成し、格納。
git init
git add .
git commit -m "first commit“
git remote add origin https://github.com/
git push -u origin main
エラーが発生。
The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.
remote origin already exists.のためうまくいっていないよう。
対策として、下記を実行。
git remote rm origin
https://qiita.com/hatorijobs/items/1cae1946656ece954c63
これでもいけず、
git reset --hard origin/master
を実行。
今度は別のエラーが発生。
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
こちらを回避するためgitを初期化。
rm -rf .git/
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/AkihiroNakamura2020/Vercel0502.git'
https://qiita.com/n0bisuke/items/93d30b863380df59163b
さらに下記も追加で試した。
git config --global init.defaultBranch main
https://zenn.dev/siba/articles/0c4c3510ddbc7d
https://qiita.com/n0bisuke/items/93d30b863380df59163b
最終的には問題が何かを特定するためにgitのコマンドの前にデバッグのコードも追加。
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push -u origin main
何とか再度githubにアップロードしてvercelに読み込ませるもcan’tの’が認識されないとのこと。
367:30 Error: `'` can be escaped with `'`, `‘`, `'`, `’`. react/no-unescaped-entities
こちらを修正し再度トライ。
./pages/ID/[id].js
Module not found: Can't resolve '../../components/Notecard' in '/vercel/path0/pages/ID'
Path0の場合の対応をおこなっていないのでエラーが発生している。
Path0を無くすようにする。ここからはひたすらデプロイの試練に挑み続けるのみ。