Reputation: 428
Everytime i try to run a npm command i get a wierd error. This happened after i ran npm config set prefix /usr/local whilst trying to install react and after that i wasnt able to run a single npm command without this error. If anyone has any idea of what this means or how to fix it please help ! thanks !
TypeError: Cannot read property 'get' of undefined
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:211:17)
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:215:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:253:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
at Array.forEach (native)
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:211
if (npm.config.get('json')) {
^
TypeError: Cannot read property 'get' of undefined
Upvotes: 0
Views: 8839
Reputation: 11
Try installing it globally first, using the command
npm install -g create-react-app
And then, you can create your app using the command,
npx create-react-app <Name of your app>
Credits : https://github.com/facebook/create-react-app/issues/9091
Upvotes: 1
Reputation: 41
cmd
as administratornpm config set prefix/usr/local
(changed the prefix)npm start
in normal consoleUpvotes: 4
Reputation:
if you are getting an EPERM you may need to open up a command prompt and specify 'run as administrator', ' I'm admin on my PC and still need to do this from time to time with NPM scripts
Upvotes: 3