Where is NPM config file? - npm

I edited the npm config file with npm edit config. I made a syntax error in it and saved the file. Now, no matter what I try with npm, it will complain about it. I know what the syntax is and I would like to fix it, but I can't find the file anywhere.
C:\Users\Arthur>npm
Error: Failed parsing JSON config key cache: "C:\Users\Le Roi Arthur\AppData\Roaming\npm-cache"
at parseField (D:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at D:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (D:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (D:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at D:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at D:\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (D:\nodejs\node_modules\npm\lib\npm.js:225:22)
at D:\nodejs\node_modules\npm\lib\npm.js:263:24
at D:\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:82:13)
at Conf.f (D:\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at Object.onceWrapper (events.js:286:20)
D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Error: Failed parsing JSON config key cache: "C:\Users\Le Roi Arthur\AppData\Roaming\npm-cache"
at parseField (D:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at D:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (D:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (D:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at D:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at D:\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (D:\nodejs\node_modules\npm\lib\npm.js:225:22)
at D:\nodejs\node_modules\npm\lib\npm.js:263:24
at D:\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at Conf.<anonymous> (D:\nodejs\node_modules\npm\lib\config\core.js:82:13)
at Conf.f (D:\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at Object.onceWrapper (events.js:286:20)
D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (D:\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Uninstalling and re-installing nodeJS doesn't fix the issue, the file is stored in cache somewhere. It's infuriately frustrating how hard it is to put my hands on that file.
Where can I find the npm config file ?

You need to edit npmrc file, take a look at documentation it will help you to find the appropriate one.
The four relevant files are:
Per-project config file: /path/to/my/project/.npmrc
Per-user config file: ~/.npmrc
Global config file: $PREFIX/npmrc
Built-in npm config file: /path/to/npm/npmrc

you can see the config file (and other) paths with the below command
npm config list

Related

Vue error when creating a project from Vue CLI

After I create a Vue3 project with the Vue cli tool, my terminal crashes and gives the following error:
🚀 Starting GUI...
🌠 Ready on http://localhost:8000
node:events:368
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, scandir '/Users/xxxx/Desktop/personal/vuetest/node_modules/#vue/cli-service/locales'
at Object.readdirSync (node:fs:1390:3)
at exports.readdir (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
at Object.safeCall [as safe] (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/call.js:24:8)
at DirectoryReader.readNextDirectory (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
at Readable.DirectoryReader.stream._read (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
at Readable.read (node:internal/streams/readable:496:27)
at readdirSync (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/sync/index.js:27:21)
at Function.readdirSyncStat (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/index.js:34:10)
at ReaderSync.dynamicApi (/usr/local/lib/node_modules/#vue/cli/node_modules/fast-glob/out/providers/reader-sync.js:64:24)
at ReaderSync.api (/usr/local/lib/node_modules/#vue/cli/node_modules/fast-glob/out/providers/reader-sync.js:56:25)
Emitted 'error' event on Readable instance at:
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: '/Users/xxxx/Desktop/personal/vuetest/node_modules/#vue/cli-service/locales'
}
Node.js v17.0.1
I cannot start the cli again until I delete the project folder. What is the problem here ?

Error: getaddrinfo EAI_AGAIN undefined (ldapjs)

So, i tried to deploy my Express.Js app to my vps, but I get some error that refined to Error: getaddrinfo EAI_AGAIN undefined. The weird part is, it is doing just fine if I run this app on my localhost. Any body knows how to resolve this issue?
Here are the error log that I get.
events.js:187
throw er; // Unhandled 'error' event
^
Error: getaddrinfo EAI_AGAIN undefined
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)
Emitted 'error' event on Client instance at:
at Backoff.<anonymous> (/home/user/deploy-folder/app-api/node_modules/ldapjs/lib/client/client.js:1228:12)
at Backoff.emit (events.js:210:5)
at Backoff.backoff (/home/user/deploy-folder/app-api/node_modules/ldapjs/node_modules/backoff/lib/backoff.js:41:14)
at /home/user/deploy-folder/app-api/node_modules/ldapjs/lib/client/client.js:1214:15
at f (/home/user/deploy-folder/app-api/node_modules/ldapjs/node_modules/once/once.js:25:25)
at Socket.onResult (/home/user/deploy-folder/app-api/node_modules/ldapjs/lib/client/client.js:1016:7)
at Object.onceWrapper (events.js:300:26)
at Socket.emit (events.js:210:5)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) {
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'undefined'
I assume that by now you discovered the error, but in this particular case it seems that the variable you are using to setup ldap is not stated or resolves to undefined.
The proper way to do it according to the documentation is this:
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://127.0.0.1:1389'
});

I am not able to create my react application on npm

$ npx create-react-app application
Error: EPERM: operation not permitted, mkdir 'C:\Users\snigdha'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20) C:\Program
Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98 var
doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27) Install for create-react-app#latest failed with code 7
Try to clean your cache with
npm cache clean

Why can't I restart my react-native application?

I'm new at react-native.
I reached to start my application but when I want to restart it I got this :
/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:83
ps.stdout.on('data', function (data) {
^
TypeError: Cannot read property 'on' of undefined
at buildProcessTree (/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:83:15)
at /usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:104:11
at Array.forEach (<anonymous>)
at ChildProcess.onClose (/usr/local/lib/node_modules/expo-cli/node_modules/tree-kill/index.js:99:31)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:978:16)
at Socket.stream.socket.on (internal/child_process.js:395:11)
at Socket.emit (events.js:189:13)
at Pipe._handle.close (net.js:610:12)
Why do I get this ?
I start my react-native app with npm start !
I found the solution.
I had to remove the file .expo in my folder.

React Packager 0.44.0

First of all I am new to react native platform and I am developing an app but I am facing one issue when I run my application after changes made in classes.
I am posting my logs below, Thank you for your help folks....
index.android.js (loads successfully but app do not run)
SyntaxError: Unexpected end of JSON input
at parse (<anonymous>)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
SyntaxError: Unexpected end of JSON input
at parse (<anonymous>)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
{
Error: write EPIPE
at _errnoException (util.js:1022:11)
at Socket._writeGeneric (net.js:767:25)
at Socket._write (net.js:786:8)
at doWrite (_stream_writable.js:387:12)
at writeOrBuffer (_stream_writable.js:373:5)
at Socket.Writable.write (_stream_writable.js:290:11)
at Socket.write (net.js:704:40)
at Socket.Writable.end (_stream_writable.js:553:10)
at Socket.end (net.js:496:31)
at Promise.resolve.then.then.then.catch.then.message
(E:\FinalDownload\takeawaymobileapp\node_modules\react-native\packager\src\Server\symbolicate\worker.js
:35:33) code: 'EPIPE', errno: 'EPIPE', syscall: 'write' }