0

I have been trying to use Vue for the past 3-4 hours now and it is feeling like an uphill battle to just get it set up.

I am following this documentation: https://cli.vuejs.org/guide/creating-a-project.html#vue-create

I have the following library versions on my computer

macOS Mojave 10.14.5
node -v v10.16.0
npm -v 6.9.0
vue --version 3.8.3

My problem is below.

$ vue create hello-world
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module './fs'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@vue/cli/node_modules/fs-extra/lib/index.js:6:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Any help would be appreciated.

I tried Node version 10.15.3 because some people had luck with it here https://github.com/vuejs/vue-cli/issues/3879

Yangshun Tay
  • 49,270
  • 33
  • 114
  • 141
Aaron Miller
  • 185
  • 11
  • 1
    Please provide more information. Are you using Yarn or any other package manager? What options did you choose when running the command? Have you tried with different Node versions? – Yangshun Tay Jun 15 '19 at 04:07
  • Based on https://npm.community/t/internal-modules-cjs-loader-js-605-throw-err-error-cannot-find-module-aproba/4786 you can try reinstalling the vue CLI and/or npm. – Yangshun Tay Jun 15 '19 at 04:14
  • 1
    Hello @YangshunTay, I am not using Yarn. I have tried sudo and I get the same error. No I have not yet. I am working with someone tomorrow morning who has a MAC and plan to get his versions and try. I have also done a full reinstall of npm, node and vue. – Aaron Miller Jun 15 '19 at 04:16
  • See this question https://stackoverflow.com/questions/39249237/node-cannot-find-module-fs-when-using-webpack – Satyam Pathak Jun 15 '19 at 06:48
  • Hey@SatyamPathak I apologize if this is a duplicate. I will try it first thing tomorrow morning – Aaron Miller Jun 15 '19 at 08:47
  • Hello again @SatyamPathak. My friend helped me fix it this morning. I did not have to change my versions of npm, node or vue – Aaron Miller Jun 16 '19 at 02:22

1 Answers1

0

It was a pretty simple fix and it had nothing to do with the versions I was running. Assuming you have used npm install -g @vue/cli and are using a mac you should be able to do:

sudo chown -R $(whoami) /usr/local/lib

Then for a fresh start do this again.

npm uninstall -g @vue/cli 
npm install -g @vue/cli

Comment if it did not work and I will try my best to help you.

Aaron Miller
  • 185
  • 11