nandkk05 / todo-app

Tried Vue for the very first time and built this to-do app
https://tasks-vuejs.netlify.app/
1 stars 0 forks source link

Error: Cannot find module 'node-sass' #3

Closed nandkk05 closed 4 years ago

nandkk05 commented 4 years ago

Config: elementary OS 5.1.4 Hera x86_64

Failed at the node-sass@4.14.1 post-install script.

Module build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at getDefaultSassImpl (/home/nand/github/todo-app/node_modules/sass-loader/dist/index.js:198:10) at Object.loader (/home/nand/github/todo-app/node_modules/sass-loader/dist/index.js:80:29)

@ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-3de47834","scoped":false,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/components/TodoList.vue 4:14-374 13:3-17:5 14:22-382 @ ./src/components/TodoList.vue @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue @ ./src/App.vue @ ./src/main.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

nandkk05 commented 4 years ago

Here's the solution:

sudo npm install --save-dev --unsafe-perm node-sass

Enjoy!

Explanation:

_--save-dev is used so that your app is able to find the module in local nodemodules. --save-dev adds package to devDependencies in package.json. --unsafe--perm is used to run install scripts as root. To avoid sudo, use nvm instead. --unsafe--perm is really not needed as sudo is already mentioned. So the command basically air tights the script to install node-sass at any cost.