我到处都搜寻了这个问题。但是仍然找不到答案。大多数答案都说代理存在问题。当我尝试使用时npm install -g package-name发生错误。
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2018-03-27T14_55_06_994Z-debug.log
Run Code Online (Sandbox Code Playgroud)
这是.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 'install',
1 verbose cli '-g',
1 verbose cli '@angular/cli' ]
2 info using npm@5.6.0
3 info using node@v8.10.0
4 verbose npm-session bd0a5d284789daec
5 silly install loadCurrentTree
6 …Run Code Online (Sandbox Code Playgroud)