Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

TypeError: Cannot read property 'get' of undefined if (npm.config.get('json')) #143

Closed
jvitoroc opened this issue Dec 27, 2017 · 4 comments

Comments

@jvitoroc
Copy link

Node version: 8.7.0
npm version: 5.4.2

"devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-minify": "^0.2.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-minify": "^0.2.0"
  }

I'm getting the following errors when I run npx minify index.js --out-file index.min.js, but the command works (file is minified)

C:\Users\João Vitor\Documents\uniqual>npx minify index.js --out-file index.min.js
Error: EPERM: operation not permitted, mkdir 'C:\Users\João'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:214:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:252:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80: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:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:374:26)
Install for prefix@latest failed with code 7
C:\Users\João Vitor\Documents\uniqual\node_modules\babel-minify\bin\minify.js

C:\Users\João Vitor\Documents\uniqual>npx minify index.js --out-file index.min.js
Error: EPERM: operation not permitted, mkdir 'C:\Users\João'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:214:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:252:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80: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:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:374:26)
Install for prefix@latest failed with code 7
C:\Users\João Vitor\Documents\uniqual\node_modules\babel-minify\bin\minify.js
@noelleleigh
Copy link
Contributor

Looks like a duplicate of #100 , caused by profiles with spaces in them.

@zkat
Copy link
Owner

zkat commented May 4, 2018

Closing as duplicate of #100

@arikkfir
Copy link

arikkfir commented Aug 4, 2018

Pasting my comment from facebook/react#11933 in case it helps others:

I got the same error (in facebook/react#11933) working for me by adding sudo, as such:

sudo npx create-react-app my-app

Note that this might be because my Node.js installation's file-system owner is indeed root rather than my own user - perhaps this is the root cause for this issue?

@sarvold
Copy link

sarvold commented Dec 19, 2018

I have same issue, it's that Windows has created my user folder with spaces in it too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants