Version: 10.7.0
Platform: 64-bit (Windows)
Subsystem: internal/modules/cjs/loader.js:631
here is my problem, i get an error while following book (Learn Node.js by Building 6 Projects) to create blog web application :
internal/modules/cjs/loader.js:631
throw new ERR_INVALID_ARG_TYPE('id', 'string', id);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined
at Module.require (internal/modules/cjs/loader.js:631:11)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Log :
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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejsnode_modules\npmnode_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\production\blog-appnode_modules.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Ruby25-x64\bin;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\ComposerSetup\bin;C:\Users\Gun Gun Febrianza\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Gun Gun Febrianza\AppData\Local\Programs\Python\Python37\;C:\Users\Gun Gun Febrianza\AppData\Local\Microsoft\WindowsApps;C:\Users\Gun Gun Febrianza\AppData\Roaming\npm;C:\Users\Gun Gun Febrianza\AppData\Local\Yarn\bin;C:\Program Files\Git\bin;C:\Ruby25-x64\bin;C:\Users\Gun Gun Febrianza\AppData\Local\atom\bin;C:\Users\Gun Gun Febrianza\AppData\Local\Microsoft\WindowsApps;C:\xampp\php;C:\Users\Gun Gun Febrianza\AppData\Roaming\Composer\vendor\bin;C:\Users\Gun Gun Febrianza\AppData\Roaming\Composer;C:\Program Files\MongoDB\Server\4.0\bin;C:\Program Files\heroku\bin
9 verbose lifecycle [email protected]~start: CWD: C:\xampp\htdocs\production\blog-app
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'node ./bin/www' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: node ./bin/www
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\xampp\htdocs\production\blog-app
16 verbose Windows_NT 10.0.17134
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 v10.7.0
19 verbose npm v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: node ./bin/www
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
at Object. (C:\xampp\htdocs\production\blog-app\app.js:13:13)
There鈥檚 a very good chance this line contains a require
call, which does not have a string as an argument when it should.
If you need more help, can I ask you to open an issue at https://github.com/nodejs/help/ instead? It鈥檚 a place that鈥檚 made for exactly this kind of conversation. If you do, including the code in app.js
might help a lot! :smile_cat:
I鈥檓 closing this issue, but like I said, https://github.com/nodejs/help/ is there if you need more information.
thank you i am come into the wrong room. pardon my mistake :)
i have tried all node_modules delete,package-lock-.json and reinstalled npm , nothing worked form help please ....
=========================
throw new ERR_INVALID_ARG_TYPE('id', 'string', id);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined
at Module.require (internal/modules/cjs/loader.js:631:11)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
@adhivenkatesh , i was also getting the same error so i changed my node version ie. deprecated it from latest node version to 6.11.1 and it works. So, u can try this
and in my case, I have forgotten to pass parameter as string to require method.
error code:
var express = require(express);
correct code:
var express = require('express');
in my case, I have forgotten to change the method require to knex:
error code:
const knex = require('knex')
const connection = require(config.development)
correct code:
const knex = require('knex')
const connection = knex(config.development)
Recently I've got this error weirdly when swapping my custom server on next.js from normal based promises and then to async/await. On Windows. Why this have happened I have no idea, but I've prefered to mention it here if anyone else like me look this issue in future having the same issues. :)
I was working with npm scripts and have the following error
parallelshell 'npm run watch:scss' 'npm run lite'
child_process.js:430
throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received function wrappedCwd
at normalizeSpawnArguments (child_process.js:430:11)
at spawn (child_process.js:546:13)
at C:\Users\Magnus\Desktop\bootstrap\Bootstrap4\conFusionnode_modules\parallelshell\index.js:104:17
at Array.forEach (
at Object.
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] watch:all: parallelshell 'npm run watch:scss' 'npm run lite'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] watch:all 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\Magnus\AppData\Roaming\npm-cache_logs\2020-06-13T12_24_50_416Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: npm run watch:all
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\Magnus\AppData\Roaming\npm-cache_logs\2020-06-13T12_24_50_474Z-debug.log
@magnuslopes23 Hey, this is a problem with the powershell, which has to be fixed manually
Go to your node_modules directory: node_modules/parallelshell/index.js
In the index.js file, change the line
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
to
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd(),
@magnuslopes23 Hey, this is a problem with the powershell, which has to be fixed manually
Go to your node_modules directory: node_modules/parallelshell/index.js
In the index.js file, change the line
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
to
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd(),
thank you so much for your help
I just downgraded my node version to the LTS version which is currently 2.18.3 and everything works fine now.
@harisiqbal12 how did you downgrade the node version to LTS version if you don't mind me asking.
C:\Users\Timon\Documents\Baden>react-native link
warn Package @react-native-community/datetimepciker has been ignored because it contains invalid configuration. Reason: Cannot find module '@react-native-community\datetimepciker\package.
json'
Require stack:
This is my error.
Please help me
@magnuslopes23 Hey, this is a problem with the powershell, which has to be fixed manually
Go to your node_modules directory: node_modules/parallelshell/index.js
In the index.js file, change the line
cwd: process.versions.node < '8.0.0' ? process.cwd : process.cwd(),
to
cwd: parseInt(process.versions.node) < 8 ? process.cwd : process.cwd(),
Thank you so much, it works
Most helpful comment
There鈥檚 a very good chance this line contains a
require
call, which does not have a string as an argument when it should.If you need more help, can I ask you to open an issue at https://github.com/nodejs/help/ instead? It鈥檚 a place that鈥檚 made for exactly this kind of conversation. If you do, including the code in
app.js
might help a lot! :smile_cat:I鈥檓 closing this issue, but like I said, https://github.com/nodejs/help/ is there if you need more information.