npm run dev suddenly stopped working - Nuxt js - vue.js

This is my terminal log, when I try to run npm run dev
cross-env HOST=0.0.0.0 PORT=3000 nuxt
module.js:545
throw err;
^
Error: Cannot find module '..'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/MYUSER/Desktop/PROJECTFOLDER/node_modules/.bin/nuxt:9:19)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! PROJECT#1.0.0 dev: `cross-env
HOST=0.0.0.0 PORT=3000 nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the PROJECT#1.0.0 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! /Users/MYUSER/.npm/_logs/2019-03-14T08_05_59_626Z-debug.log
This happened all of a sudden after 1 week working on another project.
Sorry if my tags are incorrect. Feel free to correct them. Thanks in advance.

1.delete node_modules folder
2 .delete package-lock.json
then
npm install

Related

Error: Cannot find module 'source-map-support'

Out of nowhere, my working react native app gave me this error when I opened it today. I tried npm install , yarn and cleaning the cache but nothing helped. As I said, it came out out of nowhere as everything used to work fine before that. What could be the reason for this and how can I solve it?
> expo start
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'source-map-support'
Require stack:
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js:4:30)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\xdl\\build\\index.js',
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start 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\Angel\AppData\Roaming\npm-cache\_logs\2021-06-06T18_17_52_900Z-debug.log
After lots of hours of struggle at the end I just deleted Expo and then installed it again and it worked.

Vue - Error: Cannot find module 'webpack/bin/config-yargs'

I'm new to Vue.js.
I cloned a project from github and i tried to run it by npm run dev.
Unfortunately it gives me this kind of error
> webpack-dev-server --inline --hot --env.dev
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'webpack/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\123\Desktop\python2020\Eduwonka\element-starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! element-starter# dev: `webpack-dev-server --inline --hot --env.dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the element-starter# 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\123\AppData\Roaming\npm-cache\_logs\2020-04-19T15_05_27_959Z-debug.log
Like i said before, I'm new to Vue and I have no idea where to start look for.
Anyone can please direct me what should i do? What am i doing wrong?
This was the solution npm install --save-dev webpack - I dont know why, but it worked

How do I duplicate a VueJS project?

When trying to simply duplicate a whole VueJS project using cp -r project clone_project, I get the following error when running npm run serve from the clone_projectdirectory:
> design#0.1.0 serve /Users/path_to_clone_project/clone_project
> vue-cli-service serve
internal/modules/cjs/loader.js:613
throw err;
^
Error: Cannot find module '../package.json'
Require stack:
- /Users/path_to_clone_project/clone_project/node_modules/.bin/vue-cli-service
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/Users/path_to_clone_project/clone_project/node_modules/.bin/vue-cli-service:5:25)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:824:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! design#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the design#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The original project was created using the Vue CLI tool. I don't understand the error since the package.jsonfile was copied as expected with the rest of the project.
Delete your node_modules folder and run npm install.
npm install will create node_modules folder and install all of the packages that are defined in package.json.
Then run npm run serve

ERROR Error: Cannot find module '#xtuc/long'

I am learning vueJs, I have installed my project using CLI and by project has successfully installed, the problem come when i need to run my project via terminal with a command npm run serve, below is the error that occur after running the command
$ npm run serve
> school#0.1.0 serve C:\Users\Mr chomvu\Documents\vueproject\school
> vue-cli-service serve
INFO Starting development server...
ERROR Error: Cannot find module '#xtuc/long'
Error: Cannot find module '#xtuc/long'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Mr
chomvu\Documents\vueproject\school\node_modules\#webassemblyjs\wast-
printer\lib\index.js:10:36)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! school#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the school#0.1.0 serve 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\Mr chomvu\AppData\Roaming\npm-cache\_logs\2019-
06-08T13_11_37_227Z-debug.log
I do expect after successfully compilation to have a local:
https://localhost:8080
I have attached the error image:
If you don't make any changes in project, just you trying to install and run your first vue.js app then follow this guide Creating a Project CLI, and everything will be fine.
Be sure you using the latest version of node & npm.
If you want to fix this project try remove node_modules and the package-lock.json file, and than run npm install

Error: Cannot find module 'browser-sync'

When am trying to start gulp serve
Its raise an error
module.js:338
throw err;
^
Error: Cannot find module 'browser-sync'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/sajad/p_projects/my-project/gulpfile.js:17:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
After that i tried sudo npm rm browser-sync && npm install browser-sync
its raise follwing error
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "browser-sync"
npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! file
/home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR! code
EJSONPARSE
npm ERR! Failed to parse json npm ERR! No data, empty input at 1:1 npm
ERR! npm ERR! ^ npm ERR! File:
/home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR!
Failed to parse package.json data. npm ERR! package.json must be
actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug
in npm. npm ERR! Tell the package author to fix their package.json
file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /home/sajad/p_projects/my-project/npm-debug.log
Guide me how to start gulp serve and how resolve these error
I also had a same problem, I was able to solve it by entering this.
npm i browser-sync --save
Check this link here: https://github.com/brawlins/react-webpack-php-starter/issues/1
I tried these steps. Its work for me.
Globally install gulp.
Next need to install the project’s local dependencies (that’s where it’s looking for browser-sync). To do that,
cd into the project directory and run npm install.
Then try gulp serve.
You can also try following lines
npm i browser-sync --save then
npm start
You can try a :
npm cache clean
as it looks like it's not related to your project but your npm files,
and then re run npm install
Are you behind a proxy? Because it happened once to me in a company, this specific node module wouldn't be installed because of the proxy. I had to install it without proxy to make it work. Just try on your phone or another network.