查看 Module 是在哪邊宣告套用的。
import { NativeModules, Platform } from 'react-native';
const ProgressNotification = Platform.select({
android: NativeModules.ProgressNotification,
ios: null // iOS implementation not available
});
export default ProgressNotification;
terminal 印出 module 為空值,表示未能初始化 module。
LOG ProgressNotification module: null
LOG ProgressNotification in App: null
ERROR ProgressNotification module not found
> expo r -c
zsh: command not found: expo
結果 terminal 找不到此指令。
用 npm install -g expo-cli
來安裝全域使用的 Expo CLI 工具
~/development/jim/NotificationProgress | on develop +3 !7 ?19 --- at 22:48:29
> npm install -g expo-cli
npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/expo-cli
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/expo-cli'
npm error at async mkdir (node:internal/fs/promises:858:10)
npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:624:20
npm error at async Promise.allSettled (index 0)
npm error at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'mkdir',
npm error path: '/usr/local/lib/node_modules/expo-cli'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /Users/minjing/.npm/_logs/2024-10-08T14_50_56_726Z-debug-0.log
訊息提示權限問題而無法安裝。