johnpapa / vue-getting-started

This project is seen in demos including the Pluralsight course "Vue: Getting Started" to help represent a fundamental app written with Vue. The heroes and villains theme is used throughout the app.
191 stars 169 forks source link

npm run serve failing #317

Open mohankvsnsk opened 2 years ago

mohankvsnsk commented 2 years ago

pm run serve

vue-heroes@0.1.0 serve vue-cli-service serve

ERROR TypeError: transpileDependencies.map is not a function TypeError: transpileDependencies.map is not a function at genTranspileDepRegex (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-plugin-babel/index.js:5:38) at module.exports (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-plugin-babel/index.js:21:29) at /Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-service/lib/Service.js:82:9 at Array.forEach () at loadedCallback (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-service/lib/Service.js:80:20) at Service.init (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-service/lib/Service.js:97:14) at Service.run (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-service/lib/Service.js:247:16) at Object. (/Users/kvsnskmohan/Desktop/Vue.js/vue-getting-started/02-getting-started/end/vue-heroes/node_modules/@vue/cli-service/bin/vue-cli-service.js:37:9) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

mohankvsnsk commented 2 years ago

Can anyone provide the solution

shannoneoff commented 1 year ago

Same error once I get to 'npm install'. I see a whole lot of "gyp verb ERR!" and it starts with "npm ERR! code path 1". The first path it references is ..\vue-heroes\node_modules\node-sass. Every line is an error after that.

shannoneoff commented 1 year ago

I know the error has to do with the node referenced in the code is an older version, as well as node-sass and sass-loader. For hours, I tried to get to the bottom of things but never could. Here are the best leads I could find...

Find the correct versions of Node and node-sass here: https://github.com/sass/node-sass (I believe it is Node 16.x.x + node-sass 6.x.x)

Once I was using these, the sass-loader error came up where 6.0.0 wouldn't work with ^4.0.0. There was also a possible issue with a webpack and also "TypeError: this.getOptions is not a function at Object.loader". I couldn't figure all of these out, so I will just watch the rest and do my best to pick up everything I can.

DangRock commented 1 year ago

Hope this helps... I use this course as part of my new hire training program and we recently had to get this running again. For us, at least, the fix is pretty easy:

  1. In package.json, change “node-sass”:”^4.9.0” to “sass”:”^1.32.5”
  2. If you’re version of Node (check using “node --version") is 17 or greater, at terminal, run “npm install node@16.0.0 --save-dev”

After #1, "npm install" should work. If you have node version 17 or greater, then #2 is required for "npm run serve" to work.

MaciejDygner commented 1 year ago

Hope this helps... I use this course as part of my new hire training program and we recently had to get this running again. For us, at least, the fix is pretty easy:

  1. In package.json, change “node-sass”:”^4.9.0” to “sass”:”^1.32.5”
  2. If you’re version of Node (check using “node --version") is 17 or greater, at terminal, run “npm install node@16.0.0 --save-dev”

After #1, "npm install" should work. If you have node version 17 or greater, then #2 is required for "npm run serve" to work.

Spent the last hour trying to see if I can fix this, your solution worked like a charm. Thank you.