If an integrated circuit goes inside a NES or Famicom, the failure of the part may not require the scrapping of the whole system. An exact substitute may not be on hand, so here is a list I have cobbled together of drop in replacement parts :
Official Nintendo Systems :
40H368 - 74HC368
74LS139 - 74HC139
74LS373 - 74HC373
RP2A03 - RP2A03E, G, H (unless you don't want the short noise functionality)
RP2C02B - RP2C02C, D, E, G, H (also RP2C03 RGB PPUs with mods, the RP2C05 with $2000/2001 flipping circuitry but I wouldn't trust the RP2C02A)
SRAM - Any 16Kbit/2KB, 8-bit +5v chip, 200ns or lower that will fit. Some cartridges use 8KB/64Kbit or 32KB/256Kbit 8-bit chips.
74HCU04 - 74HC04?, 74HCT04?
BU3266 - BU3270?
3193 - 3193A, 6113, 6113A, 6113B1
Famicom Disk System :
RP2C33 01 - RP2C33A-01A, RP2C33A 02 (note the logo change on the boot screen for the 02 from the Twin Famicom)
LH2838 - 4 x 16Kbit x 4 DRAMs, 150ns or better
Cartridges :
MMC1 - MMC1 & MMC1A must be used in The Money Game and Tatakae!! Ramen Man: Sakuretsu Choujin 102 Gei, otherwise those and MMC1B1, MMC1B2, MMC1B3, and MMC1C can be used in any other game.
MMC3 - MMC3A and non-Sharp MMC3Bs should not be used on games that rely on late MMC3 behavior, (Star Trek 25th Anniversary is the only known licensed game to rely on late MMC3 behavior), otherwise use these or Sharp MMC3Bs or MMC3Cs.
Official Nintendo Systems :
40H368 - 74HC368
74LS139 - 74HC139
74LS373 - 74HC373
RP2A03 - RP2A03E, G, H (unless you don't want the short noise functionality)
RP2C02B - RP2C02C, D, E, G, H (also RP2C03 RGB PPUs with mods, the RP2C05 with $2000/2001 flipping circuitry but I wouldn't trust the RP2C02A)
SRAM - Any 16Kbit/2KB, 8-bit +5v chip, 200ns or lower that will fit. Some cartridges use 8KB/64Kbit or 32KB/256Kbit 8-bit chips.
74HCU04 - 74HC04?, 74HCT04?
BU3266 - BU3270?
3193 - 3193A, 6113, 6113A, 6113B1
Famicom Disk System :
RP2C33 01 - RP2C33A-01A, RP2C33A 02 (note the logo change on the boot screen for the 02 from the Twin Famicom)
LH2838 - 4 x 16Kbit x 4 DRAMs, 150ns or better
Cartridges :
MMC1 - MMC1 & MMC1A must be used in The Money Game and Tatakae!! Ramen Man: Sakuretsu Choujin 102 Gei, otherwise those and MMC1B1, MMC1B2, MMC1B3, and MMC1C can be used in any other game.
MMC3 - MMC3A and non-Sharp MMC3Bs should not be used on games that rely on late MMC3 behavior, (Star Trek 25th Anniversary is the only known licensed game to rely on late MMC3 behavior), otherwise use these or Sharp MMC3Bs or MMC3Cs.