Cannot resolve module
跟著老師的代碼敲得,但是出現錯誤:Cannot resolve module?babel-runtime/core-js/json/stringify
store.js里的代碼如下
const STORAGE_KEY='todos-vuejs'?
export default {
fetch(){
return JSON.parse(window.localStorage.getItem(STORAGE_KEY)||'[]');
},
save(items){
window.localStorage.setItem(STORAGE_KEY,JSON.stringify(items))
}
}
2016-11-02
參考新版todolist
https://github.com/fishenal/Todos_Vuejs
2016-11-02
看起來是 ```babel-runtime/core-js/json/stringify```這個模塊沒安裝成功。
babel是用來處理es6語法的,下面帶的json庫應該自帶stringify這個工具。
重新跑npm install / cnpm install 試試。
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
json stringfy 應該是js標準庫里的東西,搞不懂為什么會被babel處理
2018-09-25
Error in Cannot find module '@babel/runtime/core-js/json/stringify'
2016-11-15
再安裝一個babel-runtime模塊就行了:cnpm install babel-runtime --save-dev