ReferenceError: resolve is not defined (`ExtractTextPlugin.extract`) - npm

Before ask this question I searched the SO, get the bellow related post:
ReferenceError: resolve is not defined
But it is not fit my case, because mine is error on the webpack config, I don;t know why get this issue.
When I use the npm run build, I get the bellow error:
/Users/ldsole/Desktop/my-project/web/wx_backup/webpack.base.config.js:51
use: ExtractTextPlugin.extract({
^
ReferenceError: resolve is not defined
at Object.<anonymous> (/Users/luowensheng/Desktop/my-project/web/wx_backup/webpack.base.config.js:51:40)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/luowensheng/Desktop/my-project/web/wx_backup/webpack.prod.config.js:5:27)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wx_backup#1.0.0 build: `webpack --progress --hide-modules --config webpack.prod.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wx_backup#1.0.0 build 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/lasdas/.npm/_logs/2018-04-08T05_51_10_773Z-debug.log
You see the npm ERR! This is probably not a problem with npm. There is likely additional logging output above., I don't know where why get the error.
My cause error code (webpack.base.config.js) is bellow:
{
test: /\.css$/,
use: ExtractTextPlugin.extract({ // there is the error line.
use: ['css-loader?minimize', 'autoprefixer-loader'],
fallback: 'style-loader'
})
},

Related

Broken Vue CLI installation npm

after trying to update vue cli to its latest version using npm update, now everytime I run vue it throws the following error:
vue create
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'strip-ansi'
Require stack:
- /usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/lib/logger.js
- /usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/index.js
- /usr/lib/node_modules/#vue/cli/bin/vue.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/lib/logger.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/lib/logger.js',
'/usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/index.js',
'/usr/lib/node_modules/#vue/cli/bin/vue.js'
]
}
Node.js v17.3.0
If I try to uninstall the package, I also get an error:
sudo npm uninstall -g #vue/cli
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/#vue/cli
npm ERR! dest /usr/lib/node_modules/#vue/.cli-kgOlUxFE
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/lib/node_modules/#vue/cli' -> '/usr/lib/node_modules/#vue/.cli-kgOlUxFE'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-17T17_58_23_457Z-debug-0.log
I don't know what to do, I need vue cli working
Thanks in advance
You can try to remove the node_modules folder and install all dependencies again with npm install.

Why I'm not able to start next.js in WSL2 [duplicate]

I am trying to build a spotify-clone using NextJS 12 and tailwind css template.
I used this command to create the project : npx create-next-app -e with-tailwindcss spotify-2.
The project was created susscessfully but as I ran npm run dev after doing a cd spotify-2, I am getting the following error :
> # dev /home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
(node:14702) UnhandledPromiseRejectionWarning: ReferenceError: TextEncoder is not defined
at /home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:67:19
at Object.<anonymous> (/home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:900:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789: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)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:6:20)
(node:14702) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14702) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ReferenceError: TextEncoder is not defined
at /home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:67:19
at Object.<anonymous> (/home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.development.server.js:900:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789: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)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/aishik-ubuntu/MEGAsync/Programming On Ubuntu/My Projects/NextJS Projects/spotify-2/node_modules/next/dist/compiled/react-server-dom-webpack/writer.browser.server.js:6:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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! /home/aishik-ubuntu/.npm/_logs/2021-11-26T18_33_22_412Z-debug.log
What should I do now?
I had the same error but with the typescript template
npx create-next-app#latest --typescript
I was running a very old node version 10. I upgraded to version 16 LTS and then it ran without error. You can check your version with this command:
node -v
System requirements on the site state node version 12.22.0.
https://nextjs.org/docs/getting-started#system-requirements

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

Error: Cannot find module 'p-map' when running npm start on create-react-app project

Encounters this error when running npm start on newly created create-react-app project:
Error: Cannot find module 'p-map'
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 Object.<anonymous> (C:\Users\jeff ramos\Documents\web-dev\react-framework-intro-2\node_modules\webpack-dev-server\node_modules\del\index.js:8:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-framework-intro-2#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-framework-intro-2#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Have you tried
npm install p-map