How To Fix 'npm Err! Cannot Read Property 'startswith' Of Null'
Solution 1:
There was no proxy set in my configs in npm. I tried npm config get proxy
it was null.
Solution 2:
Solution found
- Uninstall current version of node.js and npm from C:\Users{your_username}\AppData\Roaming
- Install an older version of node.js. You can do that here. At the time of this post I installed the LTS (Node-10.15.3 & npm-6.4.1).
- Remove http & https environment variables. (type in environment variables in search bar which should take your straight to system variables).
- Temporarily disable windows defender features.
- Restart system
- Open administrator node.js command prompt
- Enter npm install -g react-native-cli
My result output is now as expected:
C:\Windows\System32>npm install -g react-native-cli
C:\Users\dnort\AppData\Roaming\npm\react-native -> C:\Users\dnort\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli@2.0.1
added 41 packages from 15 contributors in 19.22s
This post is a continuation of my 'How to fix 'npm does not support Node.js v11.14.0 error' on Windows?' here
Note: Most solutions to similar problems have been related to proxy issues, unsupported versions of node.js/npm, environment variables
Solution 3:
this may occur cause of coding error, in my case this line caused error
<img class="cat-icon" v-bind:src="require('img/icon/' + icon)" style="width:25px;" />
try to run "npm run watch" to see detailed error
Solution 4:
I ran in to similar problem which was caused by wrong ralative path when registring components by require.context
Solution 5:
I have tried a variety of commands to delete proxy settings. I found that the best way to clear out proxy settings is to clear out related entry in .npmrc. In my case, I simply empty the whole file and restart cmd. And it works.
Post a Comment for "How To Fix 'npm Err! Cannot Read Property 'startswith' Of Null'"