我只是通过nodejs.org上的包安装了node和npm,每当我试图用npm搜索或安装某个东西时,它就会抛出以下错误
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNRESET: request to https://registry.npmjs.org/utf8 failed, reason: Client network socket disconnected before secure TLS connection was established
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN rm not removing /Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/.bin/rimraf as it wasn't installed by /Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/rimraf
npm WARN rm not removing /Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/.bin/semver as it wasn't installed by /Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/semver
npm ERR! code EACCES
npm ERR! syscall rmdir
npm ERR! path /Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rmdir '/Users/youname/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce'
npm ERR! [OperationalError: EACCES: permission denied, rmdir '/Users/youname/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce'] {
npm ERR! cause: [Error: EACCES: permission denied, rmdir '/Users/yuezonglun/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rmdir',
npm ERR! path: '/Users/youname/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce'
npm ERR! },
npm ERR! stack: "Error: EACCES: permission denied, rmdir '/Users/youname/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rmdir',
npm ERR! path: '/Users/youname/Desktop/mfbb/mfbb-rn/node_modules/@react-native-community/cameraroll/android/build/.transforms/9cbc27bddbf53510e68e9fe85a8d20ce',
npm ERR! parent: 'mfbb-rn'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/youname/.npm/_logs/2020-12-02T14_18_12_826Z-debug.log
这看起来像是主目录中的权限问题。要收回.npm目录的所有权,请执行:
sudo chown -R $(whoami) ~/.npm