NPM start error with webpack - node.js

I am learning Javascript ES6. So I have installed NodeJS along with webpack. When I run the command npm start I get the following error:
C:\Users\Saipriyank\es6>npm start
> es6#1.0.0 start C:\Users\Saipriyank\es6
> webpack --mode development
C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\cli.js:244
throw err;
^
ReferenceError: pat is not defined
at Object.<anonymous> (C:\Users\Saipriyank\es6\webpack.config.js:6:9)
at Module._compile (C:\Users\Saipriyank\es6\node_modules\v8-compile-cache\v8-compile-cache.js:178: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)
at Module.require (module.js:596:17)
at require (C:\Users\Saipriyank\es6\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\convert-argv.js:133:13)
at requireConfig (C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\convert-argv.js:135:6)
at C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\convert-argv.js:142:17
at Array.forEach (<anonymous>)
at module.exports (C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\convert-argv.js:140:15)
at yargs.parse (C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\cli.js:241:39)
at Object.parse (C:\Users\Saipriyank\es6\node_modules\yargs\yargs.js:552:18)
at C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\cli.js:219:8
at Object.<anonymous> (C:\Users\Saipriyank\es6\node_modules\webpack-cli\bin\cli.js:530:3)
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)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Saipriyank\es6\node_modules\webpack\bin\webpack.js:157:2)
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! es6#1.0.0 start: `webpack --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the es6#1.0.0 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\Saipriyank\AppData\Roaming\npm-cache\_logs\2018-08-29T05_47_41_511Z-debug.log
Here is the generated log file:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#5.6.0
3 info using node#v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle es6#1.0.0~prestart: es6#1.0.0
6 info lifecycle es6#1.0.0~start: es6#1.0.0
7 verbose lifecycle es6#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle es6#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Saipriyank\es6\node_modules\.bin;C:\Ruby24-x64\bin;System\;C:\Python27\;C:\Python27\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\xampp\php;C:\composer;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\Saipriyank\AppData\Local\Microsoft\WindowsApps;C:\Users\Saipriyank\AppData\Roaming\npm
9 verbose lifecycle es6#1.0.0~start: CWD: C:\Users\Saipriyank\es6
10 silly lifecycle es6#1.0.0~start: Args: [ '/d /s /c', 'webpack --mode development' ]
11 silly lifecycle es6#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle es6#1.0.0~start: Failed to exec start script
13 verbose stack Error: es6#1.0.0 start: `webpack --mode development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid es6#1.0.0
15 verbose cwd C:\Users\Saipriyank\es6
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error es6#1.0.0 start: `webpack --mode development`
22 error Exit status 1
23 error Failed at the es6#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The same problem also comes when I hit the npm run start command.
I am very new to nodeJS so I really need to figure out how things work around.
Any help would be appreciated.
Thanks in advance.
Here is package.json file:
{
"name": "es6",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "webpack --mode development",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.12.0",
"webpack-cli": "^3.0.3"
},
"dependencies": {
"debug": "^3.1.0"
},
"description": ""
}
Here is webpack.config.js file:
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'app'),
output: {
path: pat.resolve(__dirname, 'build'),
filename: 'bundle.js'
}
};

There is an error which says that pat is undefined. You must use path instead.
Please check the following code.
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'app'),
output: {
path: path.resolve(__dirname, 'build'), // there was the problem
filename: 'bundle.js'
}
};

As error shows "unexpected string",
You forgot to add : between filename and bundle.js.
{
context: __dirname + "/app",
entry: "./entry",
output: {
path: __dirname + "/dist",
filename: "bundle.js"
}
}
========== EDIT ===========
As per your new update, you have spelling mistake of "pat". It should be "path".
here in this line:
path: pat.resolve(__dirname, 'build'),
this should be:
path: path.resolve(__dirname, 'build'),

Related

silly lifecycle error when building Next.JS project

I recently started to learn Next/React to make a personal website, I'm trying to build a website with Next.JS, the website looks and works fine when running npm run dev, however, it's giving me an error when I try to make a build of it. I don't really understand the error, and much less how to fix it.
Thanks
Terminal Log
> portfolio# build C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
> next build
info - Checking validity of types
./pages/blog/[slug].js
26:17 Warning: Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags. #next/next/no-css-tags
./pages/index.js
12:9 Warning: Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags. #next/next/no-css-tags
13:9 Warning: External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts. #next/next/no-sync-scripts
23:13 Warning: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element. #next/next/no-img-element
./components/MDXComponents.js
4:1 Warning: Assign object to a variable before exporting as module default import/no-anonymous-default-export
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
info - Creating an optimized production build ...events.js:292
throw er; // Unhandled 'error' event
^
Error: EPERM: operation not permitted, open 'C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\.next\trace'
Emitted 'error' event on WriteStream instance at:
at C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\node_modules\next\dist\compiled\#vercel\nft\index.js:1:287421
at C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\node_modules\next\dist\compiled\#vercel\nft\index.js:1:287860
at FSReqCallback.oncomplete (fs.js:171:23) {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\\Users\\Simon\\Desktop\\#Documents\\##Projects\\Coding\\#web\\portfolio\\.next\\trace'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio# build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio# 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! C:\Users\Simon\AppData\Roaming\npm-cache\_logs\2021-11-13T12_14_00_615Z-debug.log
Log File
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Users\\Simon\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Simon\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.12
3 info using node#v14.16.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle portfolio#~prebuild: portfolio#
6 info lifecycle portfolio#~build: portfolio#
7 verbose lifecycle portfolio#~build: unsafe-perm in lifecycle true
8 verbose lifecycle portfolio#~build: PATH: // Path stuff //
9 verbose lifecycle portfolio#~build: CWD: C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
10 silly lifecycle portfolio#~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle portfolio#~build: Returned: code: 1 signal: null
12 info lifecycle portfolio#~build: Failed to exec build script
13 verbose stack Error: portfolio# build: `next build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Simon\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Simon\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid portfolio#
15 verbose cwd C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Users\\Simon\\nodejs\\node.exe" "C:\\Users\\Simon\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.16.1
19 verbose npm v6.14.12
20 error code ELIFECYCLE
21 error errno 1
22 error portfolio# build: `next build`
22 error Exit status 1
23 error Failed at the portfolio# build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
.eslintrc.json
{
"extends": "next"
}
**package.json**
{
"name": "portfolio",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.36",
"#fortawesome/free-brands-svg-icons": "^5.15.4",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.16",
"date-fns": "^2.25.0",
"gray-matter": "^4.0.3",
"next": "12.0.3",
"next-mdx-remote": "^3.0.8",
"react": "17.0.2",
"react-dom": "17.0.2",
"sass": "^1.43.4"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-next": "12.0.3"
}
}

electron: electron-forge packaging fails on Windows but works on macOS

Environment
Windows 10
electron-forge: 6.0.0-beta.51
Problem
My electron app uses electron-forge for packaging. It builds fine on macOS, but has some errors that I can't find any clue through googling the keywords
G:\myproj>npm run make
> mam-hub#0.5.0 make G:\myproj
> electron-forge make
An unhandled exception has occurred inside Forge:
Cannot find module '../innerSubscribe'
Require stack:
- G:\myproj\node_modules\rxjs\internal\operators\mergeMap.js
- G:\myproj\node_modules\rxjs\internal\operators\mergeAll.js
- G:\myproj\node_modules\rxjs\internal\operators\concatAll.js
- G:\myproj\node_modules\rxjs\internal\observable\concat.js
- G:\myproj\node_modules\rxjs\index.js
- G:\myproj\node_modules\spawn-rx\lib\src\index.js
- G:\myproj\node_modules\electron-rebuild\lib\src\rebuild.js
- G:\myproj\node_modules\electron-rebuild\lib\src\main.js
- G:\myproj\node_modules\#electron-forge\core\dist\util\rebuild.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\package.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\make.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\index.js
- G:\myproj\node_modules\#electron-forge\cli\dist\util\check-system.js
- G:\myproj\node_modules\#electron-forge\cli\dist\electron-forge.js
Error: Cannot find module '../innerSubscribe'
Require stack:
- G:\myproj\node_modules\rxjs\internal\operators\mergeMap.js
- G:\myproj\node_modules\rxjs\internal\operators\mergeAll.js
- G:\myproj\node_modules\rxjs\internal\operators\concatAll.js
- G:\myproj\node_modules\rxjs\internal\observable\concat.js
- G:\myproj\node_modules\rxjs\index.js
- G:\myproj\node_modules\spawn-rx\lib\src\index.js
- G:\myproj\node_modules\electron-rebuild\lib\src\rebuild.js
- G:\myproj\node_modules\electron-rebuild\lib\src\main.js
- G:\myproj\node_modules\#electron-forge\core\dist\util\rebuild.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\package.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\make.js
- G:\myproj\node_modules\#electron-forge\core\dist\api\index.js
- G:\myproj\node_modules\#electron-forge\cli\dist\util\check-system.js
- G:\myproj\node_modules\#electron-forge\cli\dist\electron-forge.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> (G:\myproj\node_modules\rxjs\src\internal\operators\mergeMap.ts:8:1)
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)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (G:\myproj\node_modules\rxjs\src\internal\operators\mergeAll.ts:2:1)
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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mam-hub#0.5.0 make: `electron-forge make`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mam-hub#0.5.0 make 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\me\AppData\Roaming\npm-cache\_logs\2020-08-27T10_09_38_091Z-debug.log
With the npm log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Apps\\nodejs\\node.exe',
1 verbose cli 'C:\\Apps\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'make'
1 verbose cli ]
2 info using npm#6.14.6
3 info using node#v12.18.3
4 verbose run-script [ 'premake', 'make', 'postmake' ]
5 info lifecycle mam-hub#0.5.0~premake: mam-hub#0.5.0
6 info lifecycle mam-hub#0.5.0~make: mam-hub#0.5.0
7 verbose lifecycle mam-hub#0.5.0~make: unsafe-perm in lifecycle true
8 verbose lifecycle mam-hub#0.5.0~make: PATH: C:\Apps\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;G:\p4-mmt\mam\src\mam-hub\node_modules\.bin;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\MSBuild\15.0\bin;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\;C:\Apps\ConEmu\ConEmu\Scripts;C:\Apps\ConEmu;C:\Apps\ConEmu\ConEmu;C:\Python\Python38\Scripts\;C:\Python\Python38\;C:\Python27\;C:\Python27\Scripts;D:\Downloads\winflexbison-master\bison;C:\Python\Python37-32\Scripts\;C:\Python\Python37-32\;C:\Apps\ImageMagick;C:\Apps\ActiveTCL\bin;C:\Python\Python37\Scripts\;C:\Python\Python37\;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Apps\Csound6_x64\bin;C:\Program Files\dotnet\;C:\Apps\WinMerge;C:\Apps\NextBuild;C:\ProgramData\chocolatey\bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Apps\Pandoc\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Apps\Perforce\;C:\Apps\Mercurial\;C:\Apps\_shortcuts;C:\Apps\Android\sdk\platform-tools;C:\Apps\CMake\bin;C:\Apps\LLVM\bin;E:\_dev\Qt\5.13.0\msvc2017_64\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64;C:\Apps\ImageMagick;C:\Apps\nodejs\;C:\Apps\Yarn\bin\;C:\Python\Python37-32\Scripts\;C:\Python\Python37-32\;C:\Users\me\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.4\bin;;C:\Apps\Git\bin;C:\tools\dart-sdk\bin;C:\Users\me\AppData\Roaming\Pub\Cache\bin;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\Apps\Nmap;C:\Apps\VSCode\bin;C:\Program Files\OpenSSL-Win64\bin;C:\Users\me\AppData\Roaming\npm;C:\Apps\nodejs\;C:\Users\me\AppData\Local\Yarn\bin
9 verbose lifecycle mam-hub#0.5.0~make: CWD: G:\p4-mmt\mam\src\mam-hub
10 silly lifecycle mam-hub#0.5.0~make: Args: [ '/d /s /c', 'electron-forge make' ]
11 silly lifecycle mam-hub#0.5.0~make: Returned: code: 1 signal: null
12 info lifecycle mam-hub#0.5.0~make: Failed to exec make script
13 verbose stack Error: mam-hub#0.5.0 make: `electron-forge make`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Apps\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Apps\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid mam-hub#0.5.0
15 verbose cwd G:\p4-mmt\mam\src\mam-hub
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Apps\\nodejs\\node.exe" "C:\\Apps\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "make"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error mam-hub#0.5.0 make: `electron-forge make`
22 error Exit status 1
23 error Failed at the mam-hub#0.5.0 make script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I googled innerSubscribe but saw very few results. So I suspect that it's just a bogus error caused by something else.
Here is my package.json
{
"name": "myproj",
"productName": "myproj",
"version": "0.5.0",
"description": "my project",
"main": "src/main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "me",
"email": "me#home.com"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {
"icon": "src/images/mam"
},
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"name": "mam_hub"
}
},
{
"name": "#electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "#electron-forge/maker-deb",
"config": {}
},
{
"name": "#electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"zeromq": "^6.0.0-beta.6"
},
"devDependencies": {
"#electron-forge/cli": "6.0.0-beta.52",
"#electron-forge/maker-deb": "6.0.0-beta.52",
"#electron-forge/maker-rpm": "6.0.0-beta.52",
"#electron-forge/maker-squirrel": "6.0.0-beta.52",
"#electron-forge/maker-zip": "6.0.0-beta.52",
"electron": "9.0.5"
}
}
Expectation
I'd expect that given my package.json, the packaging would work on both Windows and macOS. And a month ago things seem to work fine. Unfortunately I have no CI in place before and I bumped into this right when I started building a CI pipeline.
Question
How should I fix this?

'npm start' gives an error and does not start the development server

I'm new to node and react and am trying to start a local development server for my react app. To start it I did npm start but this put out an error. The log looks like this:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle myapp#0.1.0~prestart: myapp#0.1.0
6 info lifecycle myapp#0.1.0~start: myapp#0.1.0
7 verbose lifecycle myapp#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle myapp#0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\full-stack projects\react tutoral\myapp\node_modules\.bin;C:\Program Files\Git\mingw32\bin;C:\Program Files\Git\usr\bin;C:\Users\User\bin;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\PostgreSQL\10\bin;C:\Program Files\PostgreSQL\10\libC;C:\Program Files\Git\Python27;C:\Python27\scripts;C:\Users\User\AppData\Local\Programs\Python\Python37-32;C:\Users\User\AppData\Local\Programs\Python\Python37-32\Scripts;C:\Program Files\nodejs;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\heroku\bin;C:\Users\User\AppData\Roaming\npm
9 verbose lifecycle myapp#0.1.0~start: CWD: E:\full-stack projects\react tutoral\myapp
10 silly lifecycle myapp#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle myapp#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle myapp#0.1.0~start: Failed to exec start script
13 verbose stack Error: myapp#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid myapp#0.1.0
15 verbose cwd E:\full-stack projects\react tutoral\myapp
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.16.3
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error myapp#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the myapp#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
How do I fix this?
EDIT
Here is the package.json for the app:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
EDIT 2
I have tried all the solutions suggested, but it always shows the same errror. Here is how the error is shown in the termianl (bash):
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m
Emitted 'error' event on ChildProcess instance at:
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m {
errno: ←[32m'ENOENT'←[39m,
code: ←[32m'ENOENT'←[39m,
syscall: ←[32m'spawn cmd'←[39m,
path: ←[32m'cmd'←[39m,
spawnargs: [ ←[32m'/s'←[39m, ←[32m'/c'←[39m, ←[32m'start'←[39m, ←[32m'""'←[39m, ←[32m'/b'←[39m, ←[32m'"http://localhost:3000"'←[39m ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp#0.1.0 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\User\AppData\Roaming\npm-cache\_logs\2020-05-07T16_48_16_197Z-debug.log
ignore this line. Stackoverflow requires me to describe the problem in details since most of this is code
Ok so this problem was with the Windows system32 variable. Its actually really easy to solve. Just add the following to the PATH variable:
C:\Windows\System32

nodejs webpack server not starting

I am new to NodeJs and trying to setup react app. Getting following error on the console while starting the server.
Not able to start the server, have tried several options.
c:\Users\vaibhav\Desktop\node>npm start
> test#1.0.0 start c:\Users\vaibhav\Desktop\node
> webpack-dev-server --hot
x ?wds?: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'loaders'. These properties are valid:
object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
-> Options affecting the normal modules (`NormalModuleFactory`).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test#1.0.0 start: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vaibhav\AppData\Roaming\npm-cache\_logs\2018-09-06T17_00_03
_303Z-debug.log
The log file shows the following error:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start' ]
2 info using npm#5.6.0
3 info using node#v8.11.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle test#1.0.0~prestart: test#1.0.0
6 info lifecycle test#1.0.0~start: test#1.0.0
7 verbose lifecycle test#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle test#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;c:\Users\vaibhav\Desktop\node\node_modules\.bin;C:\Windows;C:\Windows\system32;C:\Windows\system32\wbem;C:\ProgramData\Oracle\Java\javapath;C:\app\vaibhav\product\11.2.0\client_1\bin;C:\Program Files (x86)\Attachmate\E!E2K\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Attachmate\Reflection\;C:\Users\vaibhav\AppData\Local\Programs\Python\Python36;C:\Users\vaibhav\AppData\Local\Programs\Python\Python36\Scripts;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\1E\NomadBranch\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Users\vaibhav\Documents\softwares\apache-maven-3.3.3\bin;C:\Program Files (x86)\GNU\GnuPG;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\Java\jre1.8.0_152\bin;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Program Files\nodejs\;C:\Users\vaibhav\AppData\Local\GitHubDesktop\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\vaibhav\AppData\Roaming\npm
9 verbose lifecycle test#1.0.0~start: CWD: c:\Users\vaibhav\Desktop\node
10 silly lifecycle test#1.0.0~start: Args: [ '/d /s /c', 'webpack-dev-server --hot' ]
11 silly lifecycle test#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle test#1.0.0~start: Failed to exec start script
13 verbose stack Error: test#1.0.0 start: `webpack-dev-server --hot`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid test#1.0.0
15 verbose cwd c:\Users\vaibhav\Desktop\node
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v8.11.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error test#1.0.0 start: `webpack-dev-server --hot`
22 error Exit status 1
23 error Failed at the test#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
My package.json looks like the following:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.0.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"webpack": "^4.17.2",
"webpack-dev-server": "^3.1.7"
},
"devDependencies": {
"webpack-cli": "^3.1.0"
}
}
Please let me know in case you require more details. I will provide that in comments.
The answer is in your question:
wds?: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'loaders'. These properties are valid: object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
In your config, instead of module.loaders, it has to be module.rules.

npm start not working while installing react

Please see the below files for reference. I am not able to start the npm start command while creating set up for react demo project.
**package.json**
{
"name": "package.json",
"version": "1.0.0",
"description": "Demo application",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "Abhishek",
"license": "ISC",
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
}
Webpack.config.js
var config = {
entry: './main.js',
output: {
path:'./',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
}
module.exports = config;
Please find the below logs when I ran npm.start
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#2.15.1
3 info using node#v4.4.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart package.json#1.0.0
6 info start package.json#1.0.0
7 verbose unsafe-perm in lifecycle true
8 info package.json#1.0.0 Failed to exec start script
9 verbose stack Error: package.json#1.0.0 start: `webpack-dev-server --hot`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid package.json#1.0.0
11 verbose cwd C:\Users\abhishek_pal02\Desktop\reactApp
12 error Windows_NT 6.3.9600
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.4
15 error npm v2.15.1
16 error code ELIFECYCLE
17 error package.json#1.0.0 start: `webpack-dev-server --hot`
17 error Exit status 1
18 error Failed at the package.json#1.0.0 start script 'webpack-dev-server --hot'.
18 error This is most likely a problem with the package.json package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error webpack-dev-server --hot
18 error You can get information on how to open an issue for this project with:
18 error npm bugs package.json
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls package.json
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
Please help to solve this error. Thanks in advance.
-Abhishek

Resources