'How to solve this error: "internal/modules/cjs/loader.js:638 throw err; ^"
I want to run my Vue.js using npm on localhost:8080 but they give me this error. Is there a way to solve this issue?
This error only occurs when I tried to install node_modules and package-lock.json in my Vue folder containing .babelrc, package.json and webpack.config.js. For my other Vue folders, I still can run my localhost:8080 by using the same method for all folders which is
npm install
npm run dev
The code below is the Error.
The system cannot find the path specified.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'C:\Users\acer\Documents\VueJs\cross-env\dist\bin\cross-env.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-cli@ dev: `cross-env NODE_ENV=development webpack-dev-server --open --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-cli@ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\acer\AppData\Roaming\npm-cache\_logs\2019-08-23T06_50_37_455Z-debug.log
Solution 1:[1]
Before you go uninstalling everything, try closing the terminal and trying again in a new Terminal instance
Solution 2:[2]
I had a similar issue which I solved by noticing that when I followed the advice here: https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/1056#issuecomment-699456515
and proceeded to run npm run build
which is what was giving me that error, it would work inside of the newly created project with vue create <project-name>
.
I had my code in a repository so I recloned it, copied the node_modules folder into my working directory and then ran it again and it worked.
Solution 3:[3]
If you want to update NodeJS and it is not achieving, try the nvm
instead.
I was trying in my Ubuntu and I used curl:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
If there isn't the file .bashrc
, try execute: source ~/.bashrc
And then: nvm list-remote
Finally, install: nvm install v13.6.0
(That's today version - 2021).
Solution 4:[4]
I came across this issue; This issue is a result to your external hard-drive been corrupt or affected by virus. Format your external drive or better still create your application on your computer's drive instead of external drive.
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 | CodyBugstein |
Solution 2 | Jacob Anderson |
Solution 3 | |
Solution 4 | Franklin Ukaegbu |