記一次npm run test的錯誤解決


好多錯 套中套 千層餅
用的npx create-react-app 創建的
說自帶jest,我就寫個jest測一下,看看
npx jest jest.test.js ok 沒問題
npx jest jest.test.js --watch 報錯
npm run test 報錯
報的是
TypeError:fsevents is not a function 
一開始沒有定位清除
刪了項目下的node_modu
npm install 報錯  gyp 咋咋咋 完了還要裝個node-sass的啥包
百度這個問題 解決辦法是
刪除全局的node-gyp
rm -rf .node-gyp/
全局安裝
npm install -g node-gyp
刪除全局
rm -rf /node_modules
重裝
npm install 
完了還是不行 報錯
npm ERR! Maximum call stack size exceeded npm
然后我找了一下,說是需要重裝npm,過程中又 報錯
sudo npm install npm -g
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/chownr'
又繼續執行了一遍 發現好了
sudo npm install npm -g
然后試了下還是不行
然后我又重新設置了下淘寶鏡像
npm config set registry http://registry.npm.taobao.org
再重新裝了下cnpm
sudo npm install npm -g
sudo cnpm install cnpm -g
然后分別刪了重裝全局的node_modules和項目下的node_modules 重裝 npm install
這里終於出現了前面不一樣的輸出,
然后
npm run test ok
npx jest jest.test.js --watch 報錯
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
查了下,是個小問題影響的,無傷大雅,
唉,我的美好星期六早上就這么過去了---
總結:
  原因就是刪除node_modules重裝;
  如果還有問題就重裝npm,
 
 


免責聲明!

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



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