'Module not found: Can't resolve "process" while importing axios into NextJs
I'm getting the following error:
./node_modules/axios/lib/defaults/index.js:23:4 Module not found: Can't resolve 'process'Import trace for requested module: ./node_modules/axios/lib/axios.js ./node_modules/axios/index.js ./pages/index.js
Home.getInitialProps = async ctx => {
try {
const res = await axios.get('http://localhost:1337/api/restaurants');
const restaurants = res.data;
return { restaurants };
} catch (error) {
return { error };
}
};
Where am I wrong?
Solution 1:[1]
config.resolve.fallback = {
process: false,
};
this trick solved my issue. Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Burak |
