npm run dev fails : ValidationError: Invalid options object - node.js

Currently learning Vue js and express js through some tutorials, I am still newbie regarding these technologies.
Anyway following the tutorials I am building a small project in which I have a folder "Client" that contains the frontend side of the project and another folder "Server" that contains the backend.
Just before pushing commits to Github, everything was fine, but once I did Github signals some vulnerabilities and after fixing them npm run dev doesn't work anymore.
tried multiples solutions but nothing worked, reinstalled suspicious modules, reinstalled node modules after running npm cache clean --force
This is the error I got
npm run dev
> client#1.0.0 dev D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\copy-webpack-plugin\node_modules\schema-utils\dist\validate.js:88
throw new _ValidationError.default(errors, schema, configuration);
^
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
at validate (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\copy-webpack-plugin\node_modules\schema-utils\dist\validate.js:88:11)
at new CopyPlugin (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\copy-webpack-plugin\dist\index.js:24:30)
at Object.<anonymous> (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\build\webpack.dev.conf.js:61:5)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at WEBPACK_OPTIONS (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
at requireConfig (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
at D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
at Object.<anonymous> (D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40)
at Module._compile (internal/modules/cjs/loader.js:1133:30) {
errors: [
{
keyword: 'required',
dataPath: '[0]',
schemaPath: '#/required',
params: [Object],
message: "should have required property 'patterns'",
schema: [Object],
parentSchema: [Object],
data: [Object],
children: [Array]
}
],
schema: {
definitions: { ObjectPattern: [Object], StringPattern: [Object] },
type: 'object',
additionalProperties: false,
properties: { patterns: [Object], options: [Object] },
required: [ 'patterns' ]
},
headerName: 'Copy Plugin',
baseDataPath: 'options',
postFormatter: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#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! C:\Users\iheb\AppData\Roaming\npm-cache\_logs\2020-05-21T13_56_52_099Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#1.0.0 start: `npm run dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#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\iheb\AppData\Roaming\npm-cache\_logs\2020-05-21T13_56_52_148Z-debug.log
This is the log file :
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 'run',
1 verbose cli 'build:server'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.3
4 verbose stack Error: missing script: build:server
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:116:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:436:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:391:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:434:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:161:5)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:281:12
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:115:16
4 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
5 verbose cwd D:\projects\Fullstack web apps\VueJs ExpressJs\tab-tracker\Client
6 verbose Windows_NT 10.0.18362
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:server"
8 verbose node v12.16.3
9 verbose npm v6.14.4
10 error missing script: build:server
11 verbose exit [ 1, true ]
Running npm audit gives the following :
Moderate Cross-Site Scripting
Package serialize-javascript
Patched in >=2.1.1
Dependency of uglifyjs-webpack-plugin [dev]
Path uglifyjs-webpack-plugin > serialize-javascript
More info https://npmjs.com/advisories/1426
Related dependencies
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.1.11",
I hope I provided everything for you guys, if not I will immediately provide anything to help clarify my problem, as I said I'm a newbie to web development.
UPDATE: I've trying to figure out the reason behind such error, the problem occurs after updating webpack-dev-server
Version that works :
"webpack-dev-server": "^2.9.1"
Version with errors :
"webpack-dev-server": "^3.11.0"
Is it okay if I ignore vulnerabilities found? Because trying to fix them causes this error.
Thanks

This is not an issue with webpack or webpack-dev-server itself, but with the copy-webpack-plugin plugin.
With the update to the 6.x major version came a breaking change: instead of just passing the array with the config patterns directly to the CopyWebpackPlugin constructor, your now have to wrap it in the patterns property of an object and pass that.
Old syntax:
new CopyWebpackPlugin(
[
{ from: 'src/xxx.ext', to: 'dist/xxx.ext' },
{ from: 'src/yyy.ext', to: 'dist/yyy.ext' }
]
)
New syntax:
new CopyWebpackPlugin(
{
patterns: [
{ from: 'src/xxx.ext', to: 'dist/xxx.ext' },
{ from: 'src/yyy.ext', to: 'dist/yyy.ext' }
]
}
)
They did that because the constructor now supports an additional options property:
https://webpack.js.org/plugins/copy-webpack-plugin/#options-1

After updating to 3.11 a new template appeared
plugins: [
new CopyPlugin({
patterns: [
{ from: 'source', to: 'dest' },
{ from: 'other', to: 'public' },
],
}),
],

I had the same problem. Finally, I was able to solve it using
npm install --save copy-webpack-plugin#5.1.1

If you upgrade to copy-webpack-plugin: ^6.0.3 in your package.json then following should work, when you previously copied a whole directory:
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: "[your-src-dir]/*",
to: "[your-dst-dir]/*",
},
],
}),
]
adding /* after directory target and source directory name fixed it without ignoring vulnerability, which you should never do.
Take a look at https://webpack.js.org/plugins/copy-webpack-plugin/ for more.

this works for me
at webpack.config.js file change the CopyWebpackPlugin
new CopyWebpackPlugin({
patterns: [
{ from: "fonts/**", globOptions: { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] } },
{ from: "**/*.{jpg,png}", globOptions: { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] } },
]
}),
hope I help

Reset angular toolkit version to 2.3.0 using the below command.
npm i #ionic/angular-toolkit#2.3.0 -E -D

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 modules not found

I have a debian 9 server with latest version of nodejs
I have a vuejs app when i want to build it npm run build, I have errors:
⠋ Building for production...
ERROR Failed to compile with 5 errors 12:42:13 PM
This relative module was not found:
* ../config in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/login.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/signup.vue?vue&type=script&lang=js& and 3 others
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moveup-vuejs#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moveup-vuejs#0.1.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! /root/.npm/_logs/2019-08-30T10_42_13_354Z-debug.log
This is the log it gives on error:
root#vps723374:/var/www/moveup-vuejs# cat /root/.npm/_logs/2019-08-30T10_58_13_481Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#6.9.0
3 info using node#v10.16.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle moveup-vuejs#0.1.0~prebuild: moveup-vuejs#0.1.0
6 info lifecycle moveup-vuejs#0.1.0~build: moveup-vuejs#0.1.0
7 verbose lifecycle moveup-vuejs#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle moveup-vuejs#0.1.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/moveup-vuejs/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle moveup-vuejs#0.1.0~build: CWD: /var/www/moveup-vuejs
10 silly lifecycle moveup-vuejs#0.1.0~build: Args: [ '-c', 'vue-cli-service build' ]
11 silly lifecycle moveup-vuejs#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle moveup-vuejs#0.1.0~build: Failed to exec build script
13 verbose stack Error: moveup-vuejs#0.1.0 build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid moveup-vuejs#0.1.0
15 verbose cwd /var/www/moveup-vuejs
16 verbose Linux 4.9.0-9-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error moveup-vuejs#0.1.0 build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the moveup-vuejs#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I don' t know if it heps, when i do npm install i have warnings:
root#vps723374:/var/www/moveup-vuejs# npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
My vue.js
<template>
<div>
....
</div>
</template>
<script>
import axios from "axios";
import { ApiUrl } from "../config";
export default {
name: "signup",
data() {
return {
firstname: "",
lastname: "",
email: "",
password: "",
c_password: "",
};
},
methods: {
signup: function(e) {
e.preventDefault();
axios
.post(ApiUrl + "/signup", {
firstname: this.firstname,
lastname: this.lastname,
email: this.email,
password: this.password,
c_password: this.c_password,
})
.then(response => {
console.log(response.data.success.token);
this.$router.push("/login");
})
.catch(error => {
console.log(error);
});
}
}
};
</script>
What is strange is it build perfectly on another server.
I remove the nodejs install, reinstall it, try another version, ect without success, I m running out of idea, any idea where it' s coming from ?
Thanks

NPM start error with webpack

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'),

Error: failed to fetch from registry: forever , https://registry.npmjs.org/forever

I just installed node and npm but when I am trying to install forever sudo npm install forever -g or sudo npm install -g forever I am getting this error reported in error log file.
verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'forever', '-g' ]
info using npm#1.1.0-2
info using node#v0.6.8
verbose config file /root/.npmrc
verbose config file /usr/local/etc/npmrc
verbose config file /usr/local/lib/node_modules/npm/npmrc
silly exec /usr/local/bin/node "/usr/local/lib/node_modules/npm/bin/npm-get-uid-gid.js" "nobody" 0
silly spawning [ '/usr/local/bin/node',
silly spawning [ '/usr/local/lib/node_modules/npm/bin/npm-get-uid-gid.js',
silly spawning 'nobody',
silly spawning 0 ],
silly spawning null ]
silly output from getuid/gid {"uid":99,"gid":0}
silly output from getuid/gid
verbose cache add [ 'forever', null ]
silly cache add: name, spec, args [ undefined, 'forever', [ 'forever', null ] ]
verbose parsed url { pathname: 'forever', path: 'forever', href: 'forever' }
verbose addNamed [ 'forever', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'forever', '', false ]
verbose raw, before any munging forever
verbose url resolving [ 'https://registry.npmjs.org/', './forever' ]
verbose url resolved https://registry.npmjs.org/forever
http GET https://registry.npmjs.org/forever
ERR! Error: failed to fetch from registry: forever
ERR! at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
ERR! at cb (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
ERR! at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18)
ERR! at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:109:22)
ERR! at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:198:58)
ERR! at Request.emit (events.js:88:20)
ERR! at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:356:14)
ERR! at ClientRequest.emit (events.js:67:17)
ERR! at HTTPParser.onIncoming (http.js:1238:11)
ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR! <http://github.com/isaacs/npm/issues>
Current version of Node is 6.6 (as of writing). Your log says you are using version 0.6.8. Try installing a newer version of Node.

Resources